Reverses the tokens in (a part of) a string.
Syntax: $revtok(text,N,C) ,this should speak for itself if you know tokens :)
C stands for seperation ascii character value of the text. i.e $asc(.)
N is optional and specifies a range n1-n2 in text to reverse, you could give a single single numeric but this renders the identifier useless as it will return whatever you wish to reverse
alias revtok {
if (($isid) && ($1 != $null)) {
var %delim = $iif($3 != $null,$3,$2) , %y = 1 , %text = $gettok($1,$iif($3 != $null,$2,$+(1-,$numtok($1,%delim))),%delim)
if (%delim isnum 0-255) {
while (%y <= $numtok(%text,%delim)) {
var %xc = $instok(%xc,$gettok(%text,%y,%delim),1,%delim)
inc %y
}
return %xc
}
else { echo $color(info) -s * $!revtok C is a value between 0 and 255 }
}
else { echo $color(info) -s * $!revtok insufficient parameters }
}