mIRC Home    About    Download    Register    News    Help

Print Thread
Spliting text #137676
17/12/05 12:17 PM
17/12/05 12:17 PM
Joined: Dec 2004
Posts: 40
B
bog__ Offline OP
Ameglian cow
bog__  Offline OP
Ameglian cow
B

Joined: Dec 2004
Posts: 40
i have problem, if someone tupe, for example
!lvl some*26
or
!lvl loterdas*3885

mine script will set
%alo some*26
or
%alo loterdas*3885

But how do i split it where is * to

%firstword some
and
%secondword 26

Can someone help me?

Re: Spliting text #137677
17/12/05 12:34 PM
17/12/05 12:34 PM
Joined: Apr 2003
Posts: 701
Leuven, Belgium
K
Kelder Offline
Hoopy frood
Kelder  Offline
Hoopy frood
K

Joined: Apr 2003
Posts: 701
Leuven, Belgium
$asc(*) returns 42

$gettok(loterdas*3885,1,42) returns loterdas
$gettok(loterdas*3885,2,42) returns 3885

Note that empty tokens are ignored, so $gettok(**********loterdas*****3885***,2,42) still returns 3885
More info: /help $gettok

Re: Spliting text #137678
17/12/05 12:37 PM
17/12/05 12:37 PM
Joined: Nov 2005
Posts: 42
England
A
Aenei Offline
Ameglian cow
Aenei  Offline
Ameglian cow
A

Joined: Nov 2005
Posts: 42
England
Treating your string as a tokenised list, with the * as the separator character use $gettok:

set %firstword $gettok(%alo,1,42)
set %secondword $gettok(%alo,2,42)

Re: Spliting text #137679
17/12/05 12:56 PM
17/12/05 12:56 PM
Joined: Dec 2004
Posts: 40
B
bog__ Offline OP
Ameglian cow
bog__  Offline OP
Ameglian cow
B

Joined: Dec 2004
Posts: 40
it is working, thanks a lot grin

Re: Spliting text #137680
18/12/05 04:08 AM
18/12/05 04:08 AM
Joined: Feb 2004
Posts: 2,019
Leuven, Belgium
FiberOPtics Offline
Hoopy frood
FiberOPtics  Offline
Hoopy frood

Joined: Feb 2004
Posts: 2,019
Leuven, Belgium
In addition to the examples with $gettok, it could be a good idea to read up on /tokenize, as it allows you to fill the $N params the way you please.

//tokenize 42 a*b | echo -a 1: $1 -- 2: $2


Gone.