From WikiChip
$gettok Identifier - mIRC
< mirc‎ | identifiers

Note: This feature has essentially been replaced by $gettok.$token returns the Nth $asc(C)-delimited token from a list.


Synopsis[edit]

$token(<LIST>,<N>,<C>)

Parameters[edit]

LIST: - Text list delimited by a character into tokens
N: - The token(s) to be returned. N can also be negative or a range
C: - The $asc() value which splits TEXT into tokens

If N=0, returns total number of tokens, same as $numtok(TEXT,C)
If N is greater than the total number of tokens, returns $null
If N is negative, returns tokens relative to the last token. -1 is the last token, -2 is next-to-last token, etc.
N- returns all tokens beginning with the Nth token. N1-N2 returns all tokens in the range of those 2 numbers, including the between delimiters.
Note: You can reverse the order of the number: $token(a b c,3-2,32) is the same as $token(a b c,2-3,32)
Note: N2 can also be negative: $token(a b c d e f,-2-3,32) return the token from the 3rd token to the -2th but $token(a b c d e f,-2--3,32) return e f, from -3 to -2
Note: For readability you can also code this as $token(a-b-c-d-e,2,$asc(-)).

Properties[edit]

None

Examples[edit]

Echo to the active window, the 2nd token as delimited by the $chr(45) hyphen:

//echo -a $token(a-b-c-d-e,2,45)
; returns b

Compatibility[edit]

Added: mIRC v4.5
Added on: 30 Jun 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also[edit]

[Expand]
v · d · e mIRC identifier list