Scala学习之字符串篇(六):访问字符串特定位置的字符
文章目录
在Scala中有如下几种方式来访问字符串中特定位置的字符。
scala> "hello".charAt(1)
res21: Char = e
scala> "hello"(1)
res22: Char = e
scala> "hello".apply(1)
res23: Char = e
在Scala中有如下几种方式来访问字符串中特定位置的字符。
scala> "hello".charAt(1)
res21: Char = e
scala> "hello"(1)
res22: Char = e
scala> "hello".apply(1)
res23: Char = e
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论