This example shows how to convert a Unicode string to tokens.
#include <stdio.h>
#include <unidef.h>
int main(void) {
UniChar *uni_string = L"a string, of, ,tokens";
UniChar *puni_token;
int uni_len1;
int uni_len2;
int token_count = 0;
uni_len1 = UniStrlen(uni_string);
puni_token = UniStrtok(uni_string, (UniChar *)L",");
++token_count;
/* Continue to loop through the string looking for tokens */
do
{
uni_len2 = UniStrlen(puni_token) + 1;
puni_token += uni_len2;
if(puni_token < uni_string + uni_len1)
{
puni_token = UniStrtok(puni_token, (UniChar *)L",");
++token_count;
}
else
break;
} while (1);
printf("%d tokens were found\n", token_count);
return (ULS_SUCCESS);
}