我正在使用原始字符串,但是当我打印该字符串时,每行开头都会出现额外的制表符。
这将输出:
我尝试设置不同的换行符,但没有效果。我正在使用 jEdit 作为编辑器在 Mac(OS X Tiger)上工作。无论是在 Scala 解释器中运行脚本还是将输出写入文件时,都会得到相同的结果。
有人知道这里发生了什么吗?
val rawString = """here is some text
and now im on the next line
and this is the thrid line, and we're done"""
println(rawString)
这将输出:
。
here is some text
and now im on the next line
and this is the thrid line, and we're done
我尝试设置不同的换行符,但没有效果。我正在使用 jEdit 作为编辑器在 Mac(OS X Tiger)上工作。无论是在 Scala 解释器中运行脚本还是将输出写入文件时,都会得到相同的结果。
有人知道这里发生了什么吗?
stripMargin
(尽管在其他情况下stripMargin
也很有用...)。你知道这个问题是否有任何错误报告吗? - Flaviu Cipcigan