mshackman/bofa/src/main/scala/bot/package.scala

10 lines
221 B
Scala
Raw Normal View History

2017-11-10 19:00:10 +00:00
import scala.util.control.Exception.allCatch
package object bot {
implicit class OptionInt(s: String) {
def toOptInt: Option[Int] = s match {
case "" => None
case _ => allCatch.opt(s.toInt)
}
}
}