Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Strip phone number formatting
/**
* removes any non-digit character from the phone number
* @param phoneNumber number to be de-formatted
* @return phone number digits
*/
protected String clearFormatting(String phoneNumber)
{
StringBuilder out = new StringBuilder(phoneNumber.length());
int lower = ((int)'0'-1);
int upper = ((int)'9'+1);
for (char c : phoneNumber.toCharArray() )
{ //only collect the digits
if ( lower < c && upper > c ) { out.append(c); }
}
return out.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.