title: Scala: How can I get an escaped representation of a string?
body: <p>Basically, what I'd like to do is have:</p>
  
  <pre><code> // in foo.scala
   val string = "this is a string\nover two lines"
   println(string)
   println(foo(string))
  </code></pre>
  
  <p>Do this:</p>
  
  <pre><code>% scala foo.scala
  this is a string
  over two lines
  "this is a string\nover two lines"
  </code></pre>
  
  <p>Basically looking for an analog of ruby's <code>String#inspect</code> or haskell's <code>show :: String -&gt; String</code>.</p>