Determine last character of a variable

stephen barncard stephenREVOLUTION2 at barncard.com
Wed Aug 26 13:49:57 EDT 2009


Also good for whitespace removal in some cases...

put word 1 to -1 of whatever into tOutput

-------------------------
Stephen Barncard
San Francisco
http://barncard.com



2009/8/26 Warren Kuhl <warrenkuhl at gmail.com>:
> Phil/Stephen,
>
> Thanks for your help!  I never understood what the -1 meant when dealing
> with characters.
>
> Appreciate your quick responses!
> Warren
>
>
> On 8/26/09, Phil Davis <revdev at pdslabs.net> wrote:
>>
>> Try "char 1 to -1 of tdata".
>>
>> char -1 is the last char
>> char -2 is the next-to-last char
>> and so on.
>>
>> Phil Davis
>>
>>
>> Warren Kuhl wrote:
>>
>>> This is probably a very stupid question..
>>>
>>> I am trying to extract a substring from a variable and am unsure how to
>>> determine the last character...
>>>
>>> I tried...
>>> put char 1 to last character of tdata into tsubstring
>>> ...but this fails.
>>>
>>> Thanks for any help!
>>> Warren
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>>
>>>
>>
>> --
>> Phil Davis
>>
>> PDS Labs
>> Professional Software Development
>> http://pdslabs.net
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the Use-livecode mailing list