Skip to content

Commit

Permalink
Optimized regular expression replace for phone number normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlgardner committed Apr 20, 2012
1 parent f97c145 commit df49b6a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/edu/mit/media/funf/HashUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,8 @@ public static String hashString(Context context, String msg,
}
}

// by Wei Pan
public static String formatPhoneNumber(String numberString) {
numberString = numberString.replaceAll("\\(", "");
numberString = numberString.replaceAll("\\)", "");
numberString = numberString.replaceAll("-", "");
numberString = numberString.replaceAll("\\+", "");
numberString = numberString.replaceAll("\\*", "");
numberString = numberString.replaceAll("[^0-9]+", "");
int i = numberString.length();
if (i <= 10)
return numberString;
Expand Down

0 comments on commit df49b6a

Please sign in to comment.