C examples for wchar.h:wcstok
function
<cwchar> <wchar.h>
Split wide string into tokens
wchar_t* wcstok (wchar_t* wcs, const wchar_t* delimiters);
Parameter | Description |
---|---|
wcs | C wide string to truncate. |
delimiters | delimiter wide characters. |
A pointer to the last token found in the wide string.
A null pointer is returned if there are no tokens left to retrieve.
#include <wchar.h> int main (){/*from w w w.ja v a 2 s . c om*/ wchar_t wcs[] = L"this is a test- This, a sample string."; wchar_t * pwc; wprintf (L"Splitting wide string \"%ls\" into tokens:\n",wcs); pwc = wcstok (wcs,L" ,.-"); while (pwc != NULL){ wprintf (L"%ls\n",pwc); pwc = wcstok (NULL,L" ,.-"); } return 0; }