mIRC Homepage
Posted By: ReWeNgE new funciont for $mid? - 17/10/03 03:24 PM
Hi all.
I would have a new function (if not exist already) for the command $mid ... and i suggest to use $midn grin

So... the function that i suggest is:

$midn(text,S,F)
Returns characters between position S and F in text.

This because... i have a string as: xxxx yyyy zzzz
If i want the part of this string after the first space but before of the second... therefore "yyyy" .... but i don't know how many characters are before and after "yyyy" i must to use $mid and $pos...

In fact the function $mid need S (position to star in text) and N (the number of character)... but i only know that there are 2 space in this string and between which there is mine "yyyy"... therefore i use this command:

set %text xxxx yyyy zzzz
set %pos1 $pos(%text,$chr(32),1) return 5
set %pos2 $pos(%text,$chr(32),2) return 10
set %char $calc(%pos2 -%pos1 -1) return 4 (lengh of yyyy)
set %find $mid(%text,%pos1,%char) return yyyy

It's too long!?!?!?!?! crazy
It's possible to implement this new function? $midn grin

Bye bye!!

P.S. If someone have another idea to resolve my problem i'll be happy for discussing of this wink
Posted By: Collective Re: new funciont for $mid? - 17/10/03 03:27 PM
For that you might like to try the $gettok identifier.

//echo -a $gettok(xxxx yyyy zzzz,2,32)
Posted By: ReWeNgE Re: new funciont for $mid? - 17/10/03 03:59 PM
thank you very much!!
work fine! smile

i think i'm too tired...
stop scripting today
Cya
© mIRC Discussion Forums