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

[REBOL] Trim question Re:

From: brett:codeconscious at: 11-Oct-2000 10:17

> Can someone tell me what makes this fail? > > >> a: { one two > { three four } > == " one two^/ three four " > >> a2: trim/auto copy a > == "one two^/ three four "
This I cannot explain. It doesn't look right at all. However if you define the source string differently it works: trim/auto copy rejoin [" one two" newline " three four " ] == "one two^/three four "
> >> a3: trim/with "^/" copy a2 > == ""
You got your parameters in the wrong order. Should be:
>> a3: trim/with copy a2 "^/"
== "one two three four "
> or this? > > "" > >> a3: trim/all copy a2 > == "onetwothreefour"
Is correct
> >> a4: trim/with "two" copy a3 > == ""
Again, the order of your parameters is wrong. Do this instead:
>> a4: trim/with copy a3 "two"
== "nehreefur"
> I thought the "TRIM/WITH" command removes the supplied string value and > returns the rest of the string. I tried out the examples in the new core > manual, page 235.
No. Trim/with interprets the supplied string value as a set of characters that must be removed from the source string. It does not remove sub-strings. HTH, Brett