scala
[scala] 라인 피드("\n") 관련 예시 코드
'김용환'
2017. 4. 24. 21:25
스칼라에서의 escape "\n"과 관련 코드 예시이다.
scala> "hello\nworld"
res39: String =
hello
world
scala> """hello\nworld""""
res40: String = hello\nworld"
scala> s"""hello\nworld"""
res42: String =
hello
world
scala> raw"""hello\nworld"""
res43: String = hello\nworld
scala> val x="""\n"""
x: String = \n
scala> s"""hello${x}world"""
res44: String = hello\nworld
scala> """hello${x}world"""
res45: String = hello${x}world
scala> raw"""hello${x}world""".r
res47: scala.util.matching.Regex = hello\nworld