Page 1 of 1

String functions help

Posted: Tue Nov 24, 2009 6:59 pm
by lharris
Hi - I'm somewhat embarrassed to ask this but I'm having problems finding this in the docs.
Is there a function similar to "leftstring" in other languages that will return the specified contents of a string. Such as if x="123456" then leftstring(x,3) would return "123"
I know I could probably use find to do the same but was hoping its already there.
Thanks
/leonard

Re: String functions help

Posted: Tue Nov 24, 2009 7:15 pm
by ibe
Revolution User Guide chapter 6: 'Processing Text and Data' page 174 onwards.

To get the left 3 characters:
put char 1 to 3 of "123456"
123

To get the right 3 characters
put char -3 to -1 of "123456"
456

Not that obvious but once you take the time to learn this chapter, processing text is really quite simple. And you can always make your own function leftstring that hides how Revolution does it.

Cheers,

Ismo

Re: String functions help

Posted: Tue Nov 24, 2009 7:37 pm
by lharris
Thanks - knew it had to be that simple and somewhere in the docs.
/leonard