extractExponent static method

int extractExponent(
  1. String valueString
)

Implementation

static int extractExponent(String valueString) {
  var parts = valueString.split('.');
  String value;
  if (parts.length == 2) {
    value = removeTrailingZeros(parts.last);
    if (value.isNotEmpty) {
      return -value.length;
    }
  }
  var cleanedValue = parts.first.replaceAll(RegExp('[+-]'), '');
  value = removeTrailingZeros(cleanedValue);
  return cleanedValue.length - value.length;
}