Created
September 17, 2014 19:54
-
-
Save ttldtor/93d5851fc66057649e41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object StringUtils { | |
implicit class StringImprovements(val s: String) { | |
import scala.util.control.Exception._ | |
def toIntOpt = catching(classOf[NumberFormatException]) opt s.toInt | |
def toLongOpt = catching(classOf[NumberFormatException]) opt s.toLong | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment