This example shows how to determine the number of elements in a Unicode string.
#include <stdio.h> #include <unidef.h> int main(void) { UniChar ucs1[] = L"computer"; UniChar ucs2[] = L"omc"; size_t num_elems = 0; num_elems = UniStrspn(ucs1, ucs2); if (num_elems) printf("The first %d characters were found\n", num_elems); return (ULS_SUCCESS); }