Next: str_tokbqenize, Previous: str_tokq_restore, Up: Strings [Contents]
count the number of tokens in a string
#include <suplib/str.h> int str_tokqcnt( char *string, const char *delim, int skip );
char *string
the string to parse
const char *delim
the set of characters that delimit tokens
int skip
true if consecutive delimiters are treated as a single delimiter
This routine counts the number of tokens in a string as would be
returned by str_tokq
. It does change the input string,
but restores it to its initial state upon completion. A constant
string (e.g., a statically declared string) should not be passed.
Upon success it returns the number of tokens in the string. On error it returns ‘-1’.
Diab Jerius