diff options
Diffstat (limited to 'lib/mbstring/u8cut.c')
-rw-r--r-- | lib/mbstring/u8cut.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/mbstring/u8cut.c b/lib/mbstring/u8cut.c new file mode 100644 index 0000000..3dd9663 --- /dev/null +++ b/lib/mbstring/u8cut.c @@ -0,0 +1,19 @@ +#include "macros.h" +#include "mbstring.h" + +rune +u8cut(struct u8view *restrict x, struct u8view *restrict y, const rune *seps, + size_t n) +{ + ASSUME(y != nullptr); + ASSUME(seps != nullptr); + size_t off = u8cspn(*y, seps, n); + if (x != nullptr) { + x->p = y->p; + x->len = off; + } + VSHFT(y, off); + rune ch = MBEND; + u8next(&ch, y); + return ch; +} |