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