Difference between revisions of "$gettok"

From Scriptwiki
Jump to: navigation, search
($gettok page)
 
(Adding example for negative ranges)
Line 12: Line 12:
 
  '''Note:''' ''N'' can be a range N1-N2, Example:
 
  '''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-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.
 
[[Category:Token Identifiers]]
 
[[Category:Token Identifiers]]

Revision as of 13:08, 13 October 2005

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.