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

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

Kenneth McDonald wrote:

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

use p()