10 lines
221 B
Scala
10 lines
221 B
Scala
|
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)
|
||
|
}
|
||
|
}
|
||
|
}
|