Is there a simple way to convert a Scala object to the string representation given in the REPL? For example, for Array(2, 3, 5), I’d like to get the string "Array(2, 3, 5)", and for Stream from 2, I’d like to get "Stream(2, ?)".
Is there a simple way to convert a Scala object to the string representation
Share
The REPL uses the
toStringmethod to generate its string representations of values. Thus:This works on all versions of Scala (2.7, 2.8, etc).