uniStrTok()
Searches a string for the first occurrence of any of a set of characters.
Synopsis
int uniStrTok(string s [, string set]);
Parameters
Parameter | Description |
---|---|
s | String to analyze |
set | String to search |
Return value
If nothing is found, returns -1, if an error occurs returns -2.
Errors
Missing or incorrect arguments
Description
Returns the position (character) of the first occurrence of any character from the string set in the string s.
Zero is the first character, one is the second character in s, and so forth. If no character in set s is found, the function returns -1, if an error occurs, it returns -2. The parameter set is optional, the default is the string ",.:". This means, if no comparison string is indicated, s is analyzed for the first occurrence of a comma, full stop, colon or space.
EXAMPLE
Returns the first occurrence of the character 's' within the sentence "This is a test, search the character 's' ". Note that the index starts from 0.
main()
{
int e;
string Sr = "This is a string. Search for the first 's' within
this sentence";
string se = "s";
e = uniStrTok(Sr, se);
DebugN("The first 's' is at the position", e);
}
Assignment
Strings
Availability
CTRL