Given s : String
how can I cast the result of
s.first()
into a String
?
You can use the method take
as followed:
scala> val s = "abcdef"
s: String = abcdef
scala> val first = s.take(1)
first: String = a
scala>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With