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