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

Discussion in 'Ruby' started by Kenneth McDonald, Sep 23, 2008.

  1. Again, this is for debugging purposes. Thanks for the help.
    Ken
     
    Kenneth McDonald, Sep 23, 2008
    #1
    1. Advertising

  2. Re: How to get a string to print with "special" characters s

    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/.
     
    Brian Candler, Sep 24, 2008
    #2
    1. Advertising

  3. Re: How to get a string to print with "special" characters showingas escape sequences, rather than

    Kenneth McDonald wrote:
    > Again, this is for debugging purposes. Thanks for the help.
    > Ken


    use p()
    --
    Posted via http://www.ruby-forum.com/.
     
    Roberto Casadei, Sep 24, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Punya Narra
    Replies:
    5
    Views:
    1,697
    Itai Raz
    Feb 17, 2004
  2. Austin
    Replies:
    8
    Views:
    926
    VisionSet
    Nov 18, 2003
  3. Jason Friedman

    Read STDIN as bytes rather than a string

    Jason Friedman, Jun 19, 2012, in forum: Python
    Replies:
    0
    Views:
    244
    Jason Friedman
    Jun 19, 2012
  4. Benjamin Kaplan

    Re: Read STDIN as bytes rather than a string

    Benjamin Kaplan, Jun 19, 2012, in forum: Python
    Replies:
    0
    Views:
    273
    Benjamin Kaplan
    Jun 19, 2012
  5. Jason Friedman
    Replies:
    0
    Views:
    253
    Jason Friedman
    Jun 19, 2012
Loading...

Share This Page