스칼라에서의 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
'scala' 카테고리의 다른 글
[spark2] spark SQL 예제 (0) | 2017.05.20 |
---|---|
[spark2] spark2 rdd 생성 -makeRDD (0) | 2017.04.29 |
[scala] Iterator의 continually함수 (0) | 2017.04.24 |
[scala] range와 함수 내용을 넣은 Map 만들기- 예제 (0) | 2017.04.20 |
[play2] Request 매개변수 전달하기 (0) | 2017.04.19 |