1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include "mbstring.h" size_t u8spn(u8view_t sv, const rune *p, size_t n) { rune ch; size_t k = 0, w; while (w = u8next(&ch, &sv)) { for (size_t i = 0; i < n; i++) { if (p[i] == ch) { k += w; goto found; } } break; found:; } return k; }