Page 1 of 1

Extracting part of a string from a variable

Posted: Sat Jan 17, 2015 8:57 pm
by stevenwhyte
If I have some text, e.g. "elephant" stored in the variable MyString, how would I extract the last three characters from the variable MyString to get "ant"?

In other languages, the function Right(MyString, 3) would do this but there doesn't seem to be such a function in LiveCode.

Many thanks,

Steven

Re: Extracting part of a string from a variable

Posted: Sat Jan 17, 2015 9:05 pm
by Dixie

Code: Select all

on mouseUp
   put char -3 to -1 of myString
end mouseUp

Re: Extracting part of a string from a variable

Posted: Sat Jan 17, 2015 9:17 pm
by stevenwhyte
Thank you :D