From: Rich McMullen Date: 2012-05-23T21:22:44+09:00 Subject: How to replace a letter with a corresponding number I am working through the Ruby Quiz website and I am already stuck on number 1 - Solitaire Cypher. I have a string, let's say "RUBYC ODEIS THEBE STXXX". I need to convert each letter to its corresponding number (i.e., A=1, B=2, etc.). I had hoped I could use gsub with a regexp like this: coded_text = text.gsub(/[A-Z/,[1-26]) but that doesn't work. Any ideas? -- Posted via http://www.ruby-forum.com/.