mIRC Home    About    Download    Register    News    Help

Print Thread
#268322 05/01/21 06:31 PM
Joined: Jan 2021
Posts: 2
F
fractal Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
F
Joined: Jan 2021
Posts: 2
hi there
havent been able to find out how to extract text from a long line
the line waries in length and characters but have 2 static points , the "/" that divides them.
the line would look something like this: "some.long.random.word/[31x:]/another.random.word"
i would like to get: "another.random.word" = var1 and "another.random.word" = var2
dont want to remove any special characters in the "words"
no problem if its done in 2 stadges
thnx

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127

//tokenize $asc(/) some.long.random.word/[31x:]/another.random.word | echo -a $1 vs $2 vs $3 vs $1-

You can use a literal 47 instead of $asc(/)

If the string is already in a %variable you can use $gettok(%variable,1,47) to fetch the 1st token

Joined: Jan 2021
Posts: 2
F
fractal Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
F
Joined: Jan 2021
Posts: 2
worked like a charm with $gettok(%var1,1,47) and $gettok(var2,3,47)
thnx


Link Copied to Clipboard