tr octal strings

G

Graham Nicholls

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
 
D

David A. Black

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 :)

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


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top