scala获取字符串首字符和尾字符_scala获取字符串首尾字符-CSDN博客

网站介绍:文章浏览阅读6.3k次。一、获取第一个元素1.take()scala> "hello".take(1)res12: String = h2.索引法因为字符串的本质是字符数组scala> "hello"(0)res13: Char = h3.字符串截取scala> "hello".substring(0,1)res15: String = h二、获取最后..._scala获取字符串首尾字符