Fast string tokenizer library in C.
Thread safe.
Does not modify original string.
API documentation is in the tokenz.h header file.
Just include the tokenz.h file in the files that want to use it and compile your project with tokenz.c .
char *string = "Hello, there; Lol.";
char *delims = " ,.;";
for (struct token t = tokenz(string, delims); t.end != NULL; t = tokenz(t.end, delims))
tokprintln(&t);
/* Output:
Hello
there
Lol
*/char *string = "-=--=-One-=-Two-=-Three-=--=-";
char *delim = "-=-";
for (struct token t = tokenzs(string, delim); t.end != NULL; t = tokenzs(t.end, delim))
tokprintln(&t);
/* Output:
One
Two
Three
*/char *string = "Thomas,Anderson,1962";
char delim = ',';
for (struct token t = tokenzc(string, delim); t.end != NULL; t = tokenzc(t.end, delim))
tokprintln(&t);
/* Output:
Thomas
Anderson
1962
*/Also contains token to string copy and concatenation functions.