Skip to content

Instantly share code, notes, and snippets.

@tucomel
Created October 18, 2018 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tucomel/29bb273895ec9d9dc2309ad6af8662e0 to your computer and use it in GitHub Desktop.
Save tucomel/29bb273895ec9d9dc2309ad6af8662e0 to your computer and use it in GitHub Desktop.
/**
* @param str String with special caracters
* @return double value of string
*/
public static double toDouble(String str) {
str = str.replaceAll("[^\\d]", "");
if (str != null && str.length() > 0) {
return Double.parseDouble(str) / 100;
} else {
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment