sheredom / utf8.h

📚 single header utf8 string functions for C and C++
The Unlicense
1.71k stars 122 forks source link

Fix for utf8spn not matching ASCII characters #65

Closed roxas232 closed 4 years ago

roxas232 commented 4 years ago

This example shows why the previous test values were off by one:

#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    auto len = strspn("abcdefg", "abc");
    cout<< len << endl; // 3

    len = strspn("abcdefg", "abcdefg");
    cout<< len; // 7

    return 0;
}