mIRC Home    About    Download    Register    News    Help

Print Thread
splitting up some text #240741 24/02/13 09:00 AM
Joined: Dec 2010
Posts: 89
D
dominic_eddy Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
How could I split up some text so that I only get a part of it?

Earlier I asked if I could replace [N] with someones name, for a script I'm distributing, and this is linked in, as I also want to add functionality for their ingame IDs. Only problem is, that the echo channel always says their ID's like this (ID:36) or [36]. I only want the 36 so I can add that to the copy and paste script I discussed in my last thread

Last thread(if you want to know what i'm trying to do exactly): http://forums.mirc.com/ubbthreads.php/topics/240725/Converting_text#Post240725

Re: splitting up some text [Re: dominic_eddy] #240743 24/02/13 11:40 AM
Joined: Mar 2010
Posts: 144
Masoud Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 144
Code:
/help $gettok


Nothing...
Re: splitting up some text [Re: Masoud] #240744 24/02/13 11:59 AM
Joined: Dec 2010
Posts: 89
D
dominic_eddy Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
i thought tokkens only really worked with full stops shocked? sorry i don't really understand tokkens frown

Re: splitting up some text [Re: dominic_eddy] #240745 24/02/13 02:46 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You shuld be able to use $remove() to, if you remove ( [ : from the text, then you end up with the numbers

$gettok() is also a way to do it.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: splitting up some text [Re: dominic_eddy] #240749 24/02/13 05:36 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Tokens work with any form of separator. You select the character that is the separator as part of the identifier.

//echo -a $gettok(some text here,1,32) will display "some" because it's separating on $chr(32), which is a space and you're asking for the first token. The first token is the text leading up to the first separator character.

//echo -a $gettok(ID:32,2,58) will display "32" because it's separating on $chr(58), which is a colon. The second token is the text after the first separator and before the second separator, if there is one.

So tokens work in a wide variety of ways and can be used in this situation. However, you can just use $remove as sparta mentioned and that will probably be far easier.


Invision Support
#Invision on irc.irchighway.net
Re: splitting up some text [Re: Riamus2] #240765 25/02/13 11:54 AM
Joined: Dec 2010
Posts: 89
D
dominic_eddy Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
okay thanks smile