From: Carlos Date: 2001-12-17T00:21:14+09:00 Subject: [ruby-talk:28688] Re: How do you do "character filtering" of a string using each_byte. > > 1) all digits are removed. > > 2) all lowercase are changed to uppercase. > > 3) multiple spaces are converted to one space > > 4) tab is converted to one space. > > See Jim M.'s answer -- also, here's an example of how to do it by > chaining some nice String methods: > > str = "What\t ever 123 YOU want 2 \t have" > newstr = str.tr("\t"," ").delete("[0-9]").squeeze.upcase delete("0-9") is better; he doesn't want to remove the brackets. > p newstr # => "WHATEVER YOU WANT HAVE"