Escape character with decimal value

I’m familiar with
“\xnn” to escape a hex value in a string.

Is there any way to escape a character with a decimal value?
“#{197.chr}”
works but doesn’t seem like an escape per se…
Thanks.
-r

2010/6/4 Roger P. [email protected]:

I’m familiar with
“\xnn” to escape a hex value in a string.

Is there any way to escape a character with a decimal value?
“#{197.chr}”
works but doesn’t seem like an escape per se…

There is octal

irb(main):008:0> “\011”
=> “\t”

But not decimal AFAIK. You would have to do the unescaping yourself,
e.g.

irb(main):018:0> s = ‘\33’
=> “\33”
irb(main):019:0> s.gsub(/\([1-9]\d*)/){ $1.to_i.chr }
=> “!”

Kind regards

robert