Removal of a string prefix or suffix is a really common operation:
"
http://mydomain" => mydomain
"sourcefile.java" => "sourcefile"
..but I cannot find any nice, quick way to do it in Scala. Can you
suggest something better than either:
val s = "string ending in suffix"
val result1 = s.substring(0, s.lastIndexOf("suffix"))
val regex="(.*)suffix".r;
regex(result2) = s; //extract from the regex
Ive asked on #scala without success. If nothing better, Im going to
raise a trac feature request for
RichString.withoutSuffix(String): String
RichString.withoutPrefix(String): String
-Ben