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 char *ne_token(char **str, char sep);
12
13 char *ne_qtoken(char **str, char sep, const char *quotes);
14
16 ne_token and ne_qtoken tokenize the string at the location stored in
17 the pointer str. Each time the function is called, it returns the next
18 token, and modifies the str pointer to point to the remainer of the
19 string, or NULL if there are no more tokens in the string. A token is
20 delimited by the separator character sep; if ne_qtoken is used any
21 quoted segments of the string are skipped when searching for a
22 separator. A quoted segment is enclosed in a pair of one of the
23 characters given in the quotes string.
24
25 The string being tokenized is modified each time the tokenizing
26 function is called; replacing the next separator character with a NUL
27 terminator.
28
30 The following function prints out each token in a comma-separated
31 string list, which is modified in-place:
32
33 static void splitter(char *list)
34 {
35 do {
36 printf("Token: %s\n", ne_token(&list, ','));
37 while (list);
38 }
39
41 Joe Orton <neon@lists.manyfish.co.uk>
42 Author.
43
45neon 0.30.0 31 July 2013 NE_TOKEN(3)