Returns a string with the trimmed number. E.g. {@literal numberToTrim=3.1000 > 3.1 } If numberToTrim is non-numeric, 0 is returned (should be changed.) @param numberToTrim The value to trim. @return String
(String numberToTrim)
| 68 | * @return String |
| 69 | */ |
| 70 | public static String trimZeros(String numberToTrim) |
| 71 | { |
| 72 | BigDecimal aBigD = BigDecimal.ZERO; |
| 73 | |
| 74 | try |
| 75 | { |
| 76 | aBigD = new BigDecimal(numberToTrim); |
| 77 | } |
| 78 | catch (NumberFormatException exc) |
| 79 | { |
| 80 | Logging.errorPrint("Cannot trim zeroes from " + numberToTrim + " as is not a number. Using 0 instead."); |
| 81 | } |
| 82 | |
| 83 | return trimBigDecimal(aBigD).toString(); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Trims the zeros. |
no test coverage detected