From WikiChip
Difference between revisions of "mirc/identifiers/$istok"
< mirc‎ | identifiers

(Create page for empty stub)
 
m (Fix typo)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''$istok returns $true if a matching token exists, or $false if it does not'''
+
{{mirc title|$istok identifier}}'''$istok''' returns $true if a matching token exists, or $false if it does not.
 +
 
  
 
== Synopsis ==
 
== Synopsis ==
Line 12: Line 13:
  
 
== Properties ==
 
== Properties ==
 
 
None
 
None
  
 
== Examples ==
 
== Examples ==
 +
<pre>//if ($event isin DISCONNECT JOIN) goto LABEL</pre>
  
<pre>//if ($event isin CONNECT JOIN) goto LABEL</pre>
+
If this alias is executed in the {{mIRC|on connect}} and {{mIRC|on disconnect}} events, this triggers on BOTH events because {{mIRC|isin|isin}} matches on CONNECT being a substring of DISCONNECT. Better is:
 
 
If this alias is executed in the {{mIRC|on events/on CONNECT|ON CONNECT}} and {{mIRC|on events/on DISCONNECT|ON DISCONNECT}} events, this triggers on BOTH events because {{mIRC|isin|isin}} matches on CONNECT being a substring of DISCONNECT. Better is:
 
 
<pre>//if ($istok(CONNECT JOIN,$event,32)) goto LABEL
 
<pre>//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.
 
; searches for exact match of the value of the $event string against the tokens in the space-delimited list of tokens.
Line 30: Line 29:
 
<pre>//echo -a $asctime($ctime,dddd) $istok(SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY,$asctime($ctime,dddd),32)
 
<pre>//echo -a $asctime($ctime,dddd) $istok(SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY,$asctime($ctime,dddd),32)
 
; returns $true because match is case-insensitive
 
; returns $true because match is case-insensitive
</pre>
 
 
'''Note:''' Even though {{mIRC|$upper|$upper}} and {{mIRC|$lower|$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:
 
 
<pre>//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)
 
</pre>
 
 
To have CHLOÉ and chloé both match as $true, use {{mIRC|$upper|$upper(TOKEN)}} and a capitalized LIST:
 
 
<pre>//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)
 
 
</pre>
 
</pre>
  
Line 48: Line 35:
  
 
== See also ==
 
== See also ==
* {{mIRC|$istokcs}}
+
* {{mIRC|$addtok}}
 +
* {{mIRC|$deltok}}
 +
* {{mIRC|$findtok}}
 
* {{mIRC|$gettok}}
 
* {{mIRC|$gettok}}
 +
* {{mIRC|$instok}}
 +
* {{mIRC|$istok}}
 +
* {{mIRC|$matchtok}}
 
* {{mIRC|$numtok}}
 
* {{mIRC|$numtok}}
* {{mIRC|$findtok}}
 
* {{mIRC|$matchtok}}
 
* {{mIRC|$wildtok}}
 
* {{mIRC|$addtok}}
 
* {{mIRC|$instok}}
 
 
* {{mIRC|$puttok}}
 
* {{mIRC|$puttok}}
* {{mIRC|$deltok}}
 
 
* {{mIRC|$remtok}}
 
* {{mIRC|$remtok}}
 
* {{mIRC|$reptok}}
 
* {{mIRC|$reptok}}
 
* {{mIRC|$sorttok}}
 
* {{mIRC|$sorttok}}
 +
* {{mIRC|$wildtok}}
 
* [[List of identifiers - mIRC]]
 
* [[List of identifiers - mIRC]]
 
{{mIRC identifier list}}
 
{{mIRC identifier list}}
 +
[[Category:mIRC identifiers|istok]]

Latest revision as of 12:38, 2 May 2020

$istok returns $true if a matching token exists, or $false if it does not.


Synopsis[edit]

$istok(<LIST>,<Token>,<C>)

Parameters[edit]

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[edit]

None

Examples[edit]

//if ($event isin DISCONNECT 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

Compatibility[edit]

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[edit]

[Expand]
v · d · e mIRC identifier list