Difference between revisions of "$istok"

From Scriptwiki
Jump to: navigation, search
 
m (fixed commenting syntax)
 
Line 8: Line 8:
  
 
Ascii value for dot is ''46''. String where from we are looking ''is a.b.c.d'' and we're looking for token ''b''.
 
Ascii value for dot is ''46''. String where from we are looking ''is a.b.c.d'' and we're looking for token ''b''.
  $istok(a.b.c.d, b, 46) returns $true
+
  $istok(a.b.c.d, b, 46) ;returns $true
  
 
Note that if we'll search the same match from the string ''a.b c.d'' with same parameters, $istok(a.b c.d, b, 46) returns $false because now ''b'' belongs to token a.b.
 
Note that if we'll search the same match from the string ''a.b c.d'' with same parameters, $istok(a.b c.d, b, 46) returns $false because now ''b'' belongs to token a.b.

Latest revision as of 15:47, 10 November 2005

Returns $true if token exists, otherwise returns $false.

$istok(text, token, C)

Text is the string where we are looking for the match token. C stands for ascii value of character that is used as delimiter.

Note: $istokcs() is the case-sensitive version.

Ascii value for dot is 46. String where from we are looking is a.b.c.d and we're looking for token b.

$istok(a.b.c.d, b, 46)  ;returns $true

Note that if we'll search the same match from the string a.b c.d with same parameters, $istok(a.b c.d, b, 46) returns $false because now b belongs to token a.b.

text can be anything, figurative constant, $1- or any parameters, or variables.

If you would like to check if you're name is in text the user typed. As separator we use space. Ascii value for it is 32.

on *:text:#help.script:{
  if ($istok($1-, $me, 32)) {
    beep
    notice $me Nick $nick just said your name at $chan
  }
}

See Also

  • $asc to get character's ascii value.
  • If-Then-Else for more information about if-statements.