mIRC Homepage
Posted By: mIRCusr string functions - 28/07/03 12:15 PM
hi there

i need to use string functions like substr() from php. can someone help me?

for example %first should be the first 6 letters of "HELLOGUYS" (HELLOG)

and i %last should be the last 6 letters of "HELLOGUYS" ... or all letters from the 4th letter of "HELLOGUYS" (LOGUYS)

is there a chance to do this?


thx for answer
Posted By: mIRCusr Re: string functions - 28/07/03 12:23 PM
oh i think i've found it. sorry, i've postet to fast.

please delete thread
Posted By: LocutusofBorg Re: string functions - 28/07/03 12:56 PM
Don't know what you found, but what you want is $mid()
Posted By: mIRCusr Re: string functions - 28/07/03 01:02 PM
Thats it!

I've searched for "string funktions" and get something like $left $right $mid $pos ... etc pp

Thank your for your answer!
Posted By: Hammer Re: string functions - 29/07/03 06:39 AM
$mid( ) will work of course, but I think what he asked for was based on end position; therefore, I think that he wants $left( ) and $right( ), in this instance, because of the way he phrased his question.

Quote:
%first should be the first 6 letters of "HELLOGUYS" (HELLOG)
  • var %left = $left(HELLOGUYS, 6)

Quote:
%last should be the last 6 letters of "HELLOGUYS"
  • var %right = $right(HELLOGUYS, 6)

Quote:
or all letters from the 4th letter of "HELLOGUYS"
  • var %right = $right(HELLOGUYS, -3)

    $right( , -3) because you're omitting the first 3 characters to start on the 4th.
Using $mid:

var %first = $mid(HELLOGUYS, 1, 6)
var %last = $mid(HELLOGUYS, 4)
© mIRC Discussion Forums