allow writing zeroes as decimal values

This commit is contained in:
tibbi 2016-01-21 22:59:56 +01:00
parent 82479f4854
commit c90c123971
1 changed files with 5 additions and 0 deletions

View File

@ -76,6 +76,11 @@ public class CalculatorImpl {
}
private String formatString(String str) {
// if the number contains a decimal, do not try removing the leading zero anymore, nor add group separator
// it would prevent writing values like 1.02
if (str.contains("."))
return str;
final double doubleValue = Formatter.stringToDouble(str);
return Formatter.doubleToString(doubleValue);
}