mIRC Homepage
Posted By: mur_phy /tokenize - 10/06/11 06:50 PM
Someone could explain me the command "/tokenize"
Code:
on 1:text:*:#:{
  tokenize 32 $strip($1-)
...
}
Posted By: FroggieDaFrog Re: /tokenize - 10/06/11 07:01 PM
/tokenize <delimiter> <data>
Tokenize fills $1-[$2,$3,...] with <data> separated by the specified delimiter. The delimiter is the numeric value of a character



/Example This is "$1-"
Code:
alias Example {
  echo -a Input: $1-
  var %Output = Notice how "$1-" changed
  tokenize 32 %Output
  echo -s Output: $1-
}
Posted By: Tomao Re: /tokenize - 10/06/11 09:47 PM
That line is commonly used to strip out all the space separated tokens from $1, $2, $3, etc..., depending on how many tokens being used. The /tokenize command works somewhat similar to $gettok()

Let's take the nickname Froggie Da Frog for instance:

As you can see there's a space delimiting the aforementioned three words. So to tokenize it, you'll do:
Code:
//tokenize 32 Froggie Da Frog | echo -a $0 $1 $2 $3
$0 equals to the total amount of tokens presented.
$1 equals to the word "Froggie"
$2 equals to the word "Da"
and $3 equals to the last word "frog"

You can use $numtok() and $gettok() to simulate the tokenization:
Code:
//var %x = Froggie Da Frong | echo -a $numtok(%x,32) $gettok(%x,1,32) $gettok(%x,2,32) $gettok(%x,3,32)
I hope this gives you a better idea, if not too thorough, about what tokenize command does.

P.S. you'll sometimes see people use
Code:
//tokenize 32 blah blah blah | echo -a $*
aka tokenize loop to have the tokens output vertically.
© mIRC Discussion Forums