Forum

Formatting phone nu...
 
Notifications
Clear all

Formatting phone numbers from phone address book


Igor Karelin
(@ikarelin)
Member Admin
Joined: 2 years ago
Posts: 19
Topic starter  

Sometimes you need to fo format your phone number. Here is a snippet for this:

String getFormattedPhone(String _phoneNumber) {
String _formattedString = _phoneNumber.replaceAll(RegExp('[(]'), '');
_formattedString = _formattedString.replaceAll(RegExp('[)]'), '');
_formattedString = _formattedString.replaceAll(RegExp('[-]'), '');
_formattedString = _formattedString.replaceAll(RegExp('[ ]'), '');
return _formattedString;
}

This topic was modified 11 months ago by Igor Karelin

Quote
Share: