$istok returns $true if a matching token exists, or $false if it does not.
Synopsis
$istok(<LIST>,<Token>,<C>)
Parameters
LIST: - Text list delimited by a character into tokens
Token: - The token searched for in LIST
C: - The $asc() value which splits TEXT into tokens
The search is for entire token, not partials, and the search is NOT case-sensitive. If you need the token search to be case-sensitive, use $istokcs which has the same syntax}}
Properties
None
Examples
//if ($event isin CONNECT JOIN) goto LABEL
If this alias is executed in the ON CONNECT and ON DISCONNECT events, this triggers on BOTH events because isin matches on CONNECT being a substring of DISCONNECT. Better is:
//if ($istok(CONNECT JOIN,$event,32)) goto LABEL ; searches for exact match of the value of the $event string against the tokens in the space-delimited list of tokens.
//var %filename spreadsheet.xls | var %filetype $gettok($noqt(%filename),-1,46) | echo -a %filetype $istok(xlsx xlsm,%filetype,32) ; returns false because $istok does not match the substring xls against the token xlsx
//echo -a $asctime($ctime,dddd) $istok(SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY,$asctime($ctime,dddd),32) ; returns $true because match is case-insensitive
Note: Even though $upper and $lower treat $chr(201) and $chr(233) as UPPER/lower forms of the same letter, $istok does not return $true when trying to match these 2 characters:
//var %name Chlo $+ $chr(233) | echo -a %name $istok($upper(%name) Suzy,%name,32) ; returns false because the case-insensitive search does not match $chr(233) against $chr(201)
To have CHLOÉ and chloé both match as $true, use $upper(TOKEN) and a capitalized LIST:
//var %name Chlo $+ $chr(233) | echo -a %name $istok(CHLO $+ $chr(201) Suzy,$upper(%name),32) ; returns $true because $upper converted $chr(233) to $chr(201)
Compatibility
Added: mIRC v5.5
Added on: 08 Jan 1999
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.
See also
- $istokcs
- $gettok
- $numtok
- $findtok
- $matchtok
- $wildtok
- $addtok
- $instok
- $puttok
- $deltok
- $remtok
- $reptok
- $sorttok
- List of identifiers - mIRC