Skip to content

Instantly share code, notes, and snippets.

@basarik
Last active February 15, 2017 14:35
Show Gist options
  • Save basarik/bd478b069cc481c257e1 to your computer and use it in GitHub Desktop.
Save basarik/bd478b069cc481c257e1 to your computer and use it in GitHub Desktop.
TryParse
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