mIRC Homepage
Posted By: dominic_eddy splitting up some text - 24/02/13 09:00 AM
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): https://forums.mirc.com/ubbthreads.php/topics/240725/Converting_text#Post240725
Posted By: Masoud Re: splitting up some text - 24/02/13 11:40 AM
Code:
/help $gettok
Posted By: dominic_eddy Re: splitting up some text - 24/02/13 11:59 AM
i thought tokkens only really worked with full stops shocked? sorry i don't really understand tokkens frown
Posted By: sparta Re: splitting up some text - 24/02/13 02:46 PM
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.
Posted By: Riamus2 Re: splitting up some text - 24/02/13 05:36 PM
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.
Posted By: dominic_eddy Re: splitting up some text - 25/02/13 11:54 AM
okay thanks smile
© mIRC Discussion Forums