1NE_TOKEN(3) neon API reference NE_TOKEN(3)
2
3
4
6 ne_token, ne_qtoken - string tokenizers
7
9 #include <ne_string.h>
10
11
12 char *ne_token (char **str, char sep);
13
14 char *ne_qtoken (char **str, char sep, const char *quotes);
15
16
18 ne_token and ne_qtoken tokenize the string at the location stored in
19 the pointer str. Each time the function is called, it returns the next
20 token, and modifies the str pointer to point to the remainer of the
21 string, or NULL if there are no more tokens in the string. A token is
22 delimited by the separator character sep; if ne_qtoken is used any
23 quoted segments of the string are skipped when searching for a separa‐
24 tor. A quoted segment is enclosed in a pair of one of the characters
25 given in the quotes string.
26
27
28 The string being tokenized is modified each time the tokenizing func‐
29 tion is called; replacing the next separator character with a NUL ter‐
30 minator.
31
32
34 The following function prints out each token in a comma-separated
35 string list, which is modified in-place:
36
37 static void splitter(char *list)
38 {
39 do {
40 printf("Token: %s\n", ne_token(&list, ','));
41 while (list);
42 }
43
44
46 Joe Orton <neon@webdav.org>.
47
48
49
50neon 0.25.5 20 January 2006 NE_TOKEN(3)