formatPhoneNumber static method
Formats phone number @param phoneNumber The phone number to format @returns String? Formatted phone number or null if invalid Example: PersianTools.formatPhoneNumber("09123456789") => "+98912-345-6789"
Implementation
static String? formatPhoneNumber(String phoneNumber) {
if (!_mobileRegex.hasMatch(phoneNumber)) return null;
final RegExpMatch match = _mobileRegex.firstMatch(phoneNumber)!;
return "+98${match.group(1)}-${match.group(2)}-${match.group(3)}";
}