Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Newbie : delete the end of string

 [1/4] from: pyxos::netcourrier::com at: 10-Apr-2002 10:03


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=22). It's a little bit special because we have the double quote to escape =21=21=21 Any ideas ? TIA ------------------------------------------------- =22Sound Mind, Sound Body=22 Juv=E9nal =22Lire et =EAtre curieux, c'est la m=EAme chose=22 Pascal Quignard =22Qui triomphe de lui-m=EAme poss=E8de la force=22 Lao-Tseu, extrait du Tao Te King =22Dans la course =E0 la qualit=E9, il n'y a pas de ligne d'arriv=E9e=22 David Kearns Allez voir mon site : http://www.desala.org ------------------------------------------------------------- NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar... Web/Wap : www.netcourrier.com T=E9l=E9phone/Fax : 08 92 69 00 21 (0,34 =80 TTC/min) Minitel: 3615 NETCOURRIER (0,15 =80 TTC/min)

 [2/4] from: anton:lexicon at: 10-Apr-2002 21:07


Well, I assume you have the string like this: string: {/Gen:showContextHelpCode")} then you can do either remove/part (skip tail string -2) 2 or remove/part find string {"} 2 or, if you want to modify a copy of the string copy/part string back back tail string or copy/part string skip tail string -2 or copy/part string (length? string) - 2 I have a feeling you want to get several strings like this, though? It's not really clear what you want to do. Anton.

 [3/4] from: joel:neely:fedex at: 10-Apr-2002 6:56


Hi, Richard, Richard Coffre wrote:
> Hi, > A newbie question, I understand the use of the functions remove
<<quoted lines omitted: 3>>
> 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 ]

 [4/4] 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
<<quoted lines omitted: 3>>
> 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 ]

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted