Skip to content

Scala:String

The simple string interpolator

문자열 보간(?)은 scala.StringContext에 존재한다.

val name = "James"
println(s"Hello, $name")  // Hello, James

Any processed string literal is rewritten as an instantiation and method call against this class. For example:

s"Hello, $name"

is rewritten to be:

StringContext("Hello, ", "").s(name)

Multiline string

"""
  |{
  |  "id": "2",
  |  "origin_url": "192.168.0.22:554",
  |  "state": "done"
  |}
""".stripMargin

See also

Favorite site