I am trying to avoid constructs like this:
val result = this.getClass.getSimpleName if (result.endsWith(\"$\")) result.init else result
Ok,
Rex Kerr’s answer expressed in basic Scala:
"Hi".getClass.getSimpleName match { case x if x.endsWith("$") => x.init case x => x }
although I’m not sure what part of the if–else construct you want to optimise.