int GetTokenPosX(string teststr, string tokens, int pos, int start)
Finds the string position at which the occurance of a certain token offset happens. Useful with the also vaulted functions TokenLeft() and TokenRight().
int GetTokenPosX(string teststr, string tokens, int pos, int start)
// Pass: string to be tokenized, token delimiters, token number, starting position in the string.
// Return: Position of token within the string.
{
int i, t;
int count = 0;
int length = len(teststr);
int numtoks = len(tokens);
if (pos == 0) return 0;
for (i = start; i < length; i++)
{
for (t = 0; t < numtoks; t++)
{
if (!strcmp(mid(teststr, i, 1), mid(tokens, t, 1)))
{
count++;
if (count == pos) return i;
t = numtoks;
}
}
}
return i;
}There are no talkbacks on this documentation page yet. Post the first?
Doc Nav |
![]() |
Your docs |
![]() |