floatToStrF function
Implementation
String floatToStrF(double value, TFloatFormat format, int precision, int digits) {
switch (format) {
case TFloatFormat.ffFixed:
case TFloatFormat.ffNumber:
return value.toStringAsFixed(digits);
case TFloatFormat.ffCurrency:
return value.toStringAsFixed(digits);
case TFloatFormat.ffExponent:
return value.toStringAsExponential(precision > 0 ? precision - 1 : 6);
case TFloatFormat.ffGeneral:
if (value == value.truncateToDouble() &&
value.abs() < 1e15 &&
!value.isInfinite) {
return value.toInt().toString();
}
return value.toString();
}
}