Charles Mills
12/16/2004 9:37:00 PM
If you don't like regexp you could use String#tr and String#delete.
$ ruby -e 'puts "Animals: Fox, Wolf, and Bear".delete(",:").tr("
","_")'
Animals_Fox_Wolf_and_Bear
$ ruby -e 'puts "Animals: Fox, Wolf, and
Bear".downcase.delete(",:").tr(" ","_")'
animals_fox_wolf_and_bear
You'll probably have to put more characters in #delete's argument
string.
Learning about regexps is worth the effort.
-Charlie