krobinson98
22nd January 2009, 17:00
Is there a function or a way to grab x amount of characters from the left of a string as you could with the LEFT string fucntion. For example I have string "abcd" and want to grab only the left 2 characters or "ab".

Thanks for any help.

zardoz
22nd January 2009, 17:02
string a(4)

a= "abcd"

a(1;2) gets the first 2 chars of a

toolswizard
23rd January 2009, 16:13
You may also want to use trim$() which is a combination of shiftl$() and strip$() with removes spaces from both sides of the string prior to checking for your value, unless it is position dependant.

There is also string.scan from either direction if you are looking for something in the string.