Author Topic: How to get the first letters of a variable?  (Read 1320 times)

%VAR = "cats and mice";
if (getSubStr(%VAR,0,1) $= "C" && getSubStr(%VAR,0,2) $= "A" && getSubStr(%VAR,0,3) $= "T")
that gets only "s and mice"

Is there a more efficient way of doing this?

what do you want to do?

i don't understand.

Code: [Select]
%VAR = "cats and mice";
if(getSubStr(%VAR, 0, 1) $= "C" && getSubStr(%VAR, 1, 1) $= "A" && getSubStr(%VAR, 2, 1) $= "T")
    echo("success");

It's easier to just merge all that into one:

Code: [Select]
%VAR = "cats and mice";
if(getSubStr(%VAR, 0, 3) $= "cat")
    echo("success");

It's easier to just merge all that into one:

Code: [Select]
%VAR = "cats and mice";
if(getSubStr(%VAR, 0, 3) $= "cat")
    echo("success");
That makes much more sense, but what does he want to do in addition?
that gets only "s and mice"

im trying to do a client command thing
:P

-edit thanks greek!
« Last Edit: September 24, 2012, 05:42:04 PM by MARBLE MAN »