MCPcopy Create free account
hub / github.com/PCGen/pcgen / trimZeros

Method trimZeros

code/src/java/pcgen/util/BigDecimalHelper.java:70–84  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 10

getTokenMethod · 0.95
getTokenMethod · 0.95
getTokenMethod · 0.95
writeArmorPropertyMethod · 0.95
getTokenMethod · 0.95
getCostTokenMethod · 0.95
getQtyTokenMethod · 0.95
getCheckboxesTokenMethod · 0.95
getValueTokenMethod · 0.95

Calls 3

errorPrintMethod · 0.95
trimBigDecimalMethod · 0.95
toStringMethod · 0.65

Tested by

no test coverage detected