mIRC Home    About    Download    Register    News    Help

Print Thread
#237037 12/04/12 05:46 AM
Joined: Nov 2004
Posts: 21
P
ProoN Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Nov 2004
Posts: 21
Is there a way to return the Nth "result" (or.. "position" would be a better word, I suppose) of a variable?

Example: Say I had the following:

var %test = ab1 cd2 ef3 gh4

or perhaps

var %test = ab1,cd2,ef3,gh4

and I wanted it to return only the 2nd part of that variable, "cd2", is there a way to do this, preferably without using $right or $left, ie $anidentifierthatalreadyexists(%test,2) or something with the same general concept?

ProoN #237038 12/04/12 05:57 AM
Joined: Mar 2012
Posts: 38
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
Yes, using $gettok
using this var;
Code:
var %test = ab1 cd2 ef3 gh4

you can use $gettok like so:
Code:
//var %test = ab1 cd2 ef3 gh4 | echo -a $gettok(%test,2,32)
returns: cd2
//var %test = ab1 cd2 ef3 gh4 | echo -a $gettok(%test,3,32)
returns: ef3
//var %test = ab1 cd2 ef3 gh4 | echo -a $gettok(%test,1-3,32)
returns: ab1 cd2 ef3


use /help $gettok for more information.

Last edited by Twitch; 12/04/12 06:00 AM.

Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.

Link Copied to Clipboard