How to extract characters from the middle of a string?

Scott Rossi scott at tactilemedia.com
Wed Jul 7 18:14:59 EDT 2004


Recently, "Marian Petrides"  wrote:

>>> If I have a string containing 25 characters, how do I extract the
>>> eight
>>> characters starting at position 5 in the string?
>>> 
>>> [In BASIC this would be left$(5,8)  or some such.]

>> Does this do what you want:
>> 
>>   get char 5 to 13 of tString

> Yes, it should fill the bill perfectly. I figured there was an easy way
> to do it, I just couldn't guess what.

You might almost say that text chunks have a hierarchy similar to the object
message path:

 char -> word -> line -> <container>

 get char 1 of tString
 get char 1 to 4 of tString
 get char 1 to 4 of word 3 of tString
 get char 1 to 4 of word 3 of line 2 of tString

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list