Tr octal strings

Can string.tr (and tr!) use octal values?

I can do tr '\234' '\273' to print £ symbols; how might I do this in Ruby,
please?
Ta
Graham

···

--
The answer's always "Yes". Now, what's the question?

Hi --

···

On Mon, 23 Aug 2004, Graham Nicholls wrote:

Can string.tr (and tr!) use octal values?

I can do tr '\234' '\273' to print £ symbols; how might I do this in Ruby,
please?

Just add a comma :slight_smile:

  "S".tr("\123","\124")
  => "T"

David

--
David A. Black
dblack@wobblini.net

David A. Black wrote:

Hi --

Can string.tr (and tr!) use octal values?

I can do tr '\234' '\273' to print £ symbols; how might I do this in
Ruby, please?

Just add a comma :slight_smile:

  "S".tr("\123","\124")
  => "T"

Doh! I had, but also, of course needed the f*ing quotes!

Thanks a lot.

···

On Mon, 23 Aug 2004, Graham Nicholls wrote:

--
The answer's always "Yes". Now, what's the question?