1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
10 .\" References consulted:
11 .\" GNU glibc-2 source code and manual
12 .\" Dinkumware C library reference http://www.dinkumware.com/
13 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
16 .TH WCSTOK 3 2021-03-22 "GNU" "Linux Programmer's Manual"
18 wcstok \- split wide-character string into tokens
23 .BI "wchar_t *wcstok(wchar_t *restrict " wcs \
24 ", const wchar_t *restrict " delim ,
25 .BI " wchar_t **restrict " ptr );
30 function is the wide-character equivalent of the
33 with an added argument to make it multithread-safe.
35 to split a wide-character string
37 into tokens, where a token is
38 defined as a substring not containing any wide-characters from
51 First, any delimiter wide-characters are skipped, that is, the
52 pointer is advanced beyond any wide-characters which occur in
54 If the end of the wide-character string is now
57 returns NULL, to indicate that no tokens
58 were found, and stores an appropriate value in
60 so that subsequent calls to
62 will continue to return NULL.
65 function recognizes the beginning of a token
66 and returns a pointer to it, but before doing that, it zero-terminates the
67 token by replacing the next wide-character which occurs in
70 a null wide character (L\(aq\e0\(aq),
73 so that subsequent calls will
74 continue searching after the end of recognized token.
78 function returns a pointer to the next token,
79 or NULL if no further token was found.
81 For an explanation of the terms used in this section, see
89 Interface Attribute Value
92 T} Thread safety MT-Safe
98 POSIX.1-2001, POSIX.1-2008, C99.
102 wide-character string is destructively modified during
105 The following code loops over the tokens contained in a wide-character string.
111 for (token = wcstok(wcs, L" \et\en", &state);
113 token = wcstok(NULL, L" \et\en", &state)) {