At 21:30 -0500 3/3/09, Robert Schaaf wrote:
> a_string.tr('^ -~', ' ') Any comments on efficiency?
That's pretty much equivalent to this code:
a.gsub(/[^\x20-\x7e]/, ' ')
It may or may not be faster, more to your taste, etc.
Before using it, be sure that you don't want to preserve
characters such as tabs and/or newlines...
-r
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume [email protected]
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel