Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Str(val str: String) extends AnyVal {
def isEmpty = str == null || str.isEmpty
def _1 = str.charAt(0)
def _2 = str.substring(1)
}
object Str {
def unapply(str: String): Str = new Str(str)
}
object StrTest {
def remLeadingZeros(str: String): String = str match {
case "" => ""
case Str('0', tail) => remLeadingZeros(tail)
case Str(_, tail) => tail
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.