mIRC Home    About    Download    Register    News    Help

Print Thread
instr #32860 29/06/03 04:15 AM
Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
Hello,

is there some sort of instr function to determin where in a string a specific character or text is?

i mean this

set %xpos = instr($1,"test")
/msg $me $right($1,$len($1)-xpos)

to give " string" where the inpunt was "this is a test string"

Re: instr #32861 29/06/03 04:38 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
i think u meant $pos
//echo -a $pos(this is a test string,string)
will return the position of "string" in the text which is 16

Re: instr #32862 29/06/03 05:38 AM
Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
thanks, that's what I was after

any idea how you can use a double quote inthere?

$left($1-,$calc($pos($1-, " text,1)))

Re: instr #32863 29/06/03 05:57 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
of course u can, it's not like in other languages that u have to put a string inside quotes


Re: instr #32864 29/06/03 06:02 AM
Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
when i do this i get nothing

echo 5 # $pos($1-," )

it doesn't seem to handle double quotes

Re: instr #32865 29/06/03 06:05 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
//echo -a $pos(lalala"aaa,") works fine for me..

Re: instr #32866 29/06/03 06:56 AM
Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
thanks again, small typo in my code blush