Remove Characters from the end of a String Scala
Solution 1:
How about using dropRight, which works in 2.8:-
"abc!".dropRight(1)
Which produces "abc"
Solution 2:
string.init // padding for the minimum 15 characters
Solution 3:
val str = "Hello world!"
str take (str.length - 1) mkString
Solution 4:
If you want the most efficient solution than just use:
str.substring(0, str.length - 1)