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

[REBOL] Re: Newbie : delete the end of string

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 > 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 ]