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. Advertisements

  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. Advertisements

  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. Advertisements

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,976
    Itai Raz
    Feb 17, 2004
  2. Austin
    Replies:
    8
    Views:
    1,128
    VisionSet
    Nov 18, 2003
  3. Stefan Mueller
    Replies:
    3
    Views:
    34,235
    Stefan Mueller
    Jul 23, 2006
  4. Replies:
    2
    Views:
    1,338
    Ingo Menger
    May 31, 2007
  5. keto
    Replies:
    0
    Views:
    1,360
  6. rvino
    Replies:
    0
    Views:
    4,989
    rvino
    Aug 14, 2007
  7. Peng Yu
    Replies:
    3
    Views:
    305
    C.DeRykus
    Jul 13, 2010
  8. Jason Friedman

    Read STDIN as bytes rather than a string

    Jason Friedman, Jun 19, 2012, in forum: Python
    Replies:
    0
    Views:
    323
    Jason Friedman
    Jun 19, 2012
Loading...