美文网首页
scala 字符串操作

scala 字符串操作

作者: 行走于无形之中 | 来源:发表于2019-03-13 00:32 被阅读0次
    val name = "world"
    //字符串前面加一个s,变量前加一个$符号
    val str = s"hello $name"
    println(str)

    //多行字符串
    val new_str =
      """
        |我是一个
        |多行的
        |字符串
      """.stripMargin

    println(new_str)

output

scala>  str 
str: String = hello world

scala>     println(new_str)

我是一个
多行的
字符串


scala>

相关文章

网友评论

      本文标题:scala 字符串操作

      本文链接:https://www.haomeiwen.com/subject/nfdapqtx.html