How to get a string to print with "special" characters showing as escape sequences, rather than as whitespace etc?

Again, this is for debugging purposes. Thanks for the help.
Ken

Kenneth McDonald wrote:

Again, this is for debugging purposes. Thanks for the help.
Ken

Do you mean String#inspect?

  a = "\007foo\nbar"
  puts a.inspect

···

--
Posted via http://www.ruby-forum.com/\.

Kenneth McDonald wrote:

Again, this is for debugging purposes. Thanks for the help.
Ken

use p()

···

--
Posted via http://www.ruby-forum.com/\.