[REBOL] Re: Best way to remove the last character from a string?
From: carl::cybercraft::co::nz at: 18-Dec-2004 1:08
On Tuesday, 14-December-2004 at 20:24:42 you wrote,
>I've worked out two ways to chop-off the last character of a string.
>
>Method One
>
>>> mystring: "123456"
>== "123456"
>>> mystring: head remove back tail mystring
>== "12345"
Note that REMOVE works directly on the string, so re-defining mystring and HEAD isn't
needed there...
>> mystring: "123456"
== "123456"
>> remove back tail mystring
== ""
>> mystring
== "12345"
And a fun alternative...
>> mystring: "123456"
== "123456"
>> mystring: head reverse remove head reverse mystring
== "12345"
:-)
-- Carl Read.