Skip to content

Instantly share code, notes, and snippets.

@esabook
Last active November 7, 2019 09:50
Show Gist options
  • Save esabook/1042637c9a2ea84c0247cad4adfaa385 to your computer and use it in GitHub Desktop.
Save esabook/1042637c9a2ea84c0247cad4adfaa385 to your computer and use it in GitHub Desktop.
remove leading zero for decimal result
// remove leading zero from form input,
// 0000003232 change to 3232
// 0000.002 change to 0.002
// 00,030 change to 0,030
String formatedSellingValue = roundedSellingValue
.replaceFirst("^((?![(\\.)|(\\,)]))+(?!$)", "");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment