defaultPhoneNumberSanitizer function

String defaultPhoneNumberSanitizer(
  1. String? input
)

Implementation

String defaultPhoneNumberSanitizer(String? input) {
  String out = "";

  for (var i = 0; i < input!.length; ++i) {
    var char = input[i];
    if (_isNumeric((char))) {
      out += char;
    }
  }

  if (out.length == 10 && !out.startsWith("0") && !out.startsWith("1")) {
    return "1$out";
  } else {
    return out;
  }
}