I'm trying to sanitize phone numbers in Android. Currently I'm using the well known libphonenumber library from Google, but I can't see any way of stripping withheld codes (and maybe others) from a phone number. I'm talking, in general, about those allowed codes (per carrier or country) that you can prepend to a phone number to affect to the call service (using special chars like '#', '*' or just with a fixed number).
There are many of those. E.g. in Europe you can type #31# before any phone number to hide your number to the call recipient. If I try to parse a phone number including such code with the library, it throws an exception:
String phone = "#31#666012345";
try {
PhoneNumberUtil.getInstance().parse(phone, "ES");
} catch (NumberParseException e) {
// will enter here
e.printStackTrace();
}
Any ideas on how to do this? Thank you !