mIRC Home    About    Download    Register    News    Help

Print Thread
#39521 03/08/03 10:40 PM
Joined: Jun 2003
Posts: 36
E
elroyK Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Jun 2003
Posts: 36
I was wondering how to do this, maybe with tokens but i haven't got a clue. I want it to check if a token in an array of tokens is in a string. i don't think $matchtok works.. any idea ?

#39522 03/08/03 10:44 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Umm can you be a little more descriptive? Your terminology is making me a bit confused. What do you mean by an array of tokens? mIRC doesn't have arrays, so I don't know what you're talking about. Can you provide an example maybe?

#39523 03/08/03 11:27 PM
Joined: Jun 2003
Posts: 36
E
elroyK Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Jun 2003
Posts: 36
never mind, matchtok seems to do the job.

#39524 04/08/03 07:57 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
There are 4 token identifiers used when searching for a token. Each has a different use, depending on what information you need returned. $findtok gives a token position, $matchtok and $wildtok return the tokens themselves, and $istok returns $true or $false if the substring is/isn't a token.

$findtok is used to find the Nth position number of a known complete token:
  • $findtok(pencil crayon stylus pen chalk, pen, 1, 32) returns 4 since pen is the fourth space-delimited token.
$matchtok is used if you only know an exact substring portion of a token to return the Nth token itself:
  • $matchtok(pencil crayon stylus pen chalk, pen, 1, 32) returns pencil since it is the first token that has "pen" in it.
    $matchtok(pencil crayon stylus pen chalk, pen, 2, 32) returns pen since it is the second token that has "pen" in it.
$wildtok is used like $matchtext, except you can use ? (single character) and * (0 or more characters) for the parts you don't know:
  • $wildtok(pencil crayon stylus pen chalk, p?n*, 1, 32) returns pencil ("e" matches ? and "cil" matches *)
    $wildtok(pencil crayon stylus pen chalk, p?n*, 2, 32) returns pen ("e" matches ? and "" matches *)
$istok is used if you only want to know if the token exists (in its complete form):
  • $istok(pencil crayon stylus pen chalk, pen, 32) returns $true (it's the fourth token)
As with most identifiers of this sort, you can use $*tok(string, substring, 0, 32) to return the number of matches found in the entire string, where $*tok is $findtok, $matchtok or $wildtok.

NOTE: There are case-sensitive versions of each: $findtokcs(), $matchtokcs(), $wildtokcs() and $istokcs().


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard