Geek Women Japan 2016 Advent Calendar 24th day pinch hitter article. I've summarized what I've been addicted to recently doing Scala.
Scala's String can use methods other than java.lang.String, so I will introduce it. There was almost no information in Japanese, so I will summarize it. (I checked if Ruby reverse is in Scala)
If you search for "Scala String" on Google, Hishidama's site will hit first. The first thing written there is:
Scala handles strings as java.lang.String. That is, it is a Java character string itself and is an immutable object.
If you read only this, it will look like "Scala String and Java String are the same". (* I'm sorry I finished reading here even though there is a continuation)
The methods of the following classes can be used as the methods that can be used in Scala.
scala> var hoge="scala"
hoge: String = scala
scala> hoge.reverse
res0: String = alacs
scala> hoge.length
res1: Int = 5
Because StringOps is defined as a function to automatically (implicitly) convert in Predef.
-Scala string memo (Hishidama's Scala String Memo)
Recommended Posts