Answer the question
In order to leave comments, you need to log in
Is there a good library for working with phone number formats?
Good day.
The polymorphism of the user input of phone numbers makes me depressed. +7.5554443322, 8 926 7500000, 8 (495) 000 - 0000 and so on. Is there a ready-made library that brings all possible options to some single form? I can't find anything suitable. Rummaged all apache commons. Google points to some lib from the android package, but there are a lot of dependencies and I don’t want to pull for the sake of one function at all.
Thank you!
Answer the question
In order to leave comments, you need to log in
You are not oppressed by polymorphism, but by some other -ism.
In the phone number, all characters, except for numbers and, possibly, the leading plus, have only a decorative function and can be removed. After that, the number can be in one of only two options - either +75554443322
, or 85554443322
. Can you handle this?
This is already extreme laziness, what is so difficult about such an elementary task? Mask input? If the data is already coming from somewhere, is it difficult to remove everything except numbers from the line and then do it as it should or is convenient? All this will take a couple of lines of code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question