From: David Alan Black Date: 2001-12-17T04:11:09+09:00 Subject: [ruby-talk:28702] Re: String filtering, character-wise (was: Re: How do you do "character filtering" of a string using each_byte. II) Hi -- On Mon, 17 Dec 2001, ts wrote: > str = "hello 123 I am a String" > str.gsub!(/./m) do |b| > case b > when /[[:lower:]]/ > "\\x" + "%x" % b[0] # this is % that you want ? Yes, that's cool. Any reason not to write it as: "\\x%x" % b[0] (Or was it just for visual clarity?) Also I like (being reminded of) the [:lower] character class (which I tend to forget about for some reason and reintroduce the problem which it solves). David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav