scala2.10版本之后版本
scala输出字符格式化前缀f
val num=12
println(f"this is $num%.2f")
scala的raw插入符号不会对字符进行转义
- 其它的
val str=s"hello\nworld"
println(str)
输出
hello
world
raw
scala的raw插入符号
val str=raw"hello\nworld"
println(str)
输出
hello\nworld
2.10之前版本
val num=12
println("this is %d".format(age))
268

被折叠的 条评论
为什么被折叠?



