removeTrailingZeros static method
Implementation
static String removeTrailingZeros(String valueString) {
var buffer = StringBuffer();
var zeroBuffer = StringBuffer();
for (var idx = 0; idx < valueString.length; idx++) {
if (valueString[idx] == '.' ||
valueString[idx] == '-' ||
valueString[idx] == '+') {
continue;
}
if (valueString[idx] == '0') {
zeroBuffer.write('0');
continue;
}
if (zeroBuffer.isNotEmpty) {
buffer.write(zeroBuffer);
zeroBuffer.clear();
}
buffer.write(valueString[idx]);
}
return '$buffer';
}