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

[REBOL] small parse problem Re:(3)

From: rryost:home at: 17-Sep-2000 16:18

OK, I've extended the function in my last message to get a one-liner that yields the strings Joel wanted:
>> chpurl: func [url][foreach x parse first parse url "&" "-" [prin mold x
prin " "] print ""]
>> u1: "www.abc.com&blah-blah&stuff"
== "www.abc.com&blah-blah&stuff"
>> u2: "www.abc.com-extra&blah-blah"
== "www.abc.com-extra&blah-blah"
>> chpurl u1
www.abc.com
>> chpurl u2
www.abc.com "extra" Note the second & in u1 is ignored; 'first does that. The final 'print "" inserts a terminating line feed-carriage return. Russell [rryost--home--com]