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

[REBOL] Re: Fast way to strip characters

From: dhsunanda:gm:ail at: 7-Oct-2009 16:50

> what is a *fast* way to strip chars unwanted from a string?
The replies so far assume you have an explicit list of the unwanted chars. If instead you are starting with a list of conforming chars, and you want to remove anything that does not conform, you need a slightly different approach. One way is to use 'trim twice: good-chars: " abcdefhgijklmnopqrstuvwxyz" target: "this: is a string!" trim/with target trim/with copy target good-chars == "this is a string" Other ways include using parse with the complement of a bit set. But that may not be forward compatible with R3 Sunanda.