Modules:QuickList:Tokens
From Anope Wiki
Contents |
Tokens
Anope provides a number of non-destructive token functions. The use of these is prefered over strtok and related functions.
myStrGetToken
Get a token from a string.
char *myStrGetToken(const char *str, const char dilim, int token_number)
This function gets tokens delimited by the given dilim character. It examines the source tring str, and returns token number token_number from the string, where number 0 is the first token. Note that this function allocates memory for the return string, which should be freed when it is no longer needed.
myStrGetOnlyToken
Get only the token from a string.
char *myStrGetOnlyToken(const char *str, const char dilim, int token_number)
This function gets tokens delimited by the given dilim character and removes any trailing newline-characters (\r or \n) from the return value, which makes this function safe to use when reading files. It examines the source tring str, and returns token number token_number from the string, where number 0 is the first token. Note that this function allocates memory for the return string, which should be freed when it is no longer needed.
myStrGetTokenRemainder
Get the remainder of a tokenized string.
char *myStrGetTokenRemainder(const char *str, const char dilim, int token_number)
This function gets the remainder of a string with tokens delimited by the given dilim character. It examines the source string str, and returns the part of the string starting with token number token_number, where number 0 is the first token. Note that this function allocates memory for the return string, which should be freed when it is no longer needed.

