summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-21 05:03:42 +0000
committerPaul Phillips <paulp@improving.org>2011-01-21 05:03:42 +0000
commite6167d9350b8f268379d0b4683400fb7950f0d13 (patch)
tree37205481d2b6c668877cd0ad7be8d1cf44c3bade /src/library
parent3715aa127c51cbcae87af34c088e013d56cb128f (diff)
downloadscala-e6167d9350b8f268379d0b4683400fb7950f0d13.tar.gz
scala-e6167d9350b8f268379d0b4683400fb7950f0d13.tar.bz2
scala-e6167d9350b8f268379d0b4683400fb7950f0d13.zip
The empty string commit made me hungry to actua...
The empty string commit made me hungry to actually know what's in stuff. Now it prints quotes around a string if it's empty or if either the first or last character is whitespace. No review.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index 5d1fad896a..956147ab4a 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -290,6 +290,7 @@ object ScalaRunTime {
def inner(arg: Any): String = arg match {
case null => "null"
case "" => "\"\""
+ case x: String => if (x.head.isWhitespace || x.last.isWhitespace) "\"" + x + "\"" else x
case x if useOwnToString(x) => x.toString
case x: AnyRef if isArray(x) => WrappedArray make x take maxElements map inner mkString ("Array(", ", ", ")")
case x: collection.Map[_, _] => x take maxElements map mapInner mkString (x.stringPrefix + "(", ", ", ")")