There certainly must be a reason but why is a string with characters considered as valid ?
ex : +33123456789-blabla
Because it contains enough information to be normalizable to a E164 number. Does that help?
yes, but from the wiki page I can tell that a E164 number contains only numbers, so I thought that would be invalid.
maybe adding an option to consider the non digit chars would be helpful ? or not ?
I am unsure – are you referring to the plausible? method when you say valid?
Here's a description of plausible?: https://github.com/floere/phony#plausibility – does that help? Let me put this another way: What is the goal you are trying to achieve?
At first that was to validate an active record field, but i found phony-rails, which normalize before validating. So that does not really matter anymore. Just for the discussion now :
I read your definition of 'plausible' : can't we say that a number with a character is wrong with a certainty of 100% ?
You make a good point. Perhaps the current plausible? should be renamed to normalizable? and I should write a more strict plausible? method.
The original plausible? method came out of wanting to know whether a number is normalizable, but also ok to save into a database. And yes, the current description rather points towards a plausible number not including characters, indeed. Good catch!
I will have to think about it – input welcome!
Leaving this on here as a reminder to think about this.
I thought this was going to be a question about numbers such as +1 555 88BINGO and +1 555 DIY TOOL. :)