Last active
February 15, 2017 14:35
-
-
Save basarik/bd478b069cc481c257e1 to your computer and use it in GitHub Desktop.
TryParse
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
String text = "12"; | |
Double message; | |
try { | |
message = Double.valueOf(text); | |
} catch (NumberFormatException e) { | |
// did not contain a valid double | |
message = 0.0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment