JString::strspn

UTF-8 aware alternative to strspn Find length of initial segment matching mask