countryCodeFormat function

String countryCodeFormat(
  1. String number
)

countryCodeFormat

Returns the phone number with country code format 263. @throws LocalRegexException if the given number is not a valid number.

Implementation

String countryCodeFormat(String number) {
  if (number.length < 9) {
    throw LocalRegexException('Phone number length cannot be less than 9');
  }
  final phoneNumber = number.substring(number.length - 9);
  return '263${phoneNumber.clean}';
}