normalizeDigits static method

StringBuffer normalizeDigits(
  1. String number,
  2. bool keepNonDigits
)

Implementation

static StringBuffer normalizeDigits(String number, bool keepNonDigits) {
  StringBuffer normalizedDigits = StringBuffer();
  for (int i = 0; i < number.length; i++) {
    final String c = number[i];
    final int? digit = characterToDigit(c);
    if (digit != null) {
      normalizedDigits.write(digit);
    } else if (keepNonDigits) {
      normalizedDigits.write(c);
    }
  }

  return normalizedDigits;
}