[REBOL] Re: Newbie : delete the end of string
From: richard:coffre:francetelecom at: 10-Apr-2002 14:25
Thanks Joel and Anton for your answers.
Through your answers I realize the power of Rebol.
Is there any clue to choose one solution or the other ?
-----Message d'origine-----
De : Joel Neely [mailto:[joel--neely--fedex--com]]
Envoy=E9 : mercredi 10 avril 2002 13:57
=C0 : [rebol-list--rebol--com]
Objet : [REBOL] Re: Newbie : delete the end of string
Hi, Richard,
Richard Coffre wrote:
> Hi,
>
> A newbie question, I understand the use of the functions remove
> and clear but I don't know how to delete the 2 last characters
> in a string such as /Gen:showContextHelpCode").
> It's a little bit special because we have the double quote to
> escape !!!
>
>> foo: randstr 10
== "@?nX#M-F&R"
>> clear back back tail foo
== ""
>> foo
== "@?nX#M-F"
Or, for generality,
>> foo: randstr 10
== "lX.7&'#Fsb"
>> clear skip tail foo -2
== ""
>> foo
== "lX.7&'#F"
so that the -2 can be changed to delete a different number of
characters from the end.
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]