$gettok

From Scriptwiki
Revision as of 14:08, 13 October 2005 by Albie (talk | contribs) (Adding example for negative ranges)

Jump to: navigation, search

Returns the Nth token or amount of tokens in string.

$gettok(string,N,C)

Where N is the Nth token you wish to be returned from string by delimiter C. Alternatively N can be given as 0 to return the amount of tokens in string

Example

$gettok(Ave:IT,1,58) returns Ave

This returns the first token using $chr(58) as the delimiter

$gettok(Ave:IT,0,58) returns 2

This returns the value 2 because there is two values when delimited by $chr(58)

Note: N can be a range N1-N2, Example:
$gettok(Word1 Word2 Word3 Word4,2-3,32) returns Word2 Word3
$gettok(Word1 Word2 Word3 Word4,-2-1,32) returns Word3 Word4

The second example would return the second token from the end until one token from the end.