Open manueljordan opened 5 years ago
@manueljordan You may want to take a look at the data underlying this API. It was not designed for arbitrary digits with a regex-like pattern. I too would like to be able to specify a format, but my need is mainly for delimiter differences.
Take a look at this file in the project: src/main/resources/en-US.yml
and search for phone_number
I'm assuming those formats are common to a non-US country. I did not look into the other configuration files in that directory, but maybe you can get what you need by adding to one of the YML files in there.
Hello @kellerj , yes, I saw that file, sadly in my country the patterns numbers change for each city. It about two important things:
And even more, would be: (054)-226711 or (051)-2588769
Thus I need set the length or pattern manually (and restrict the two first digits)
Hi, is there an option to generate fake cellPhone() that will contain country code all the time?
Is this feature support to international phone prefix or numbers? I am thinking here of the plus sign. https://en.wikipedia.org/wiki/List_of_country_calling_codes
You can use a regex directly:
Faker.instance().expression("#{regexify '" + PHONE_NUMER_REGEX + "'}")
I suggest this one: https://phoneregex.com/
I am playing a lot with this wonderful library, thanks for this tool
Well, I am working in peace until some point with:
faker.phoneNumber().cellPhone()
faker.phoneNumber().phoneNumber()
Just curious if I can set the phone number or cell phone format prior to be generated to the following patterns:
######
(possible in someway just withfaker.numerify("######")
)##-##-##
(possible in someway just withfaker.numerify("##-##-##")
)Even better to something like: (mostly I need this)
[2-4]#-##-##
to get valid just: (22-67-11 23-88-99 38-20-15 * 43-98-44 )[2-4]#####
to get valid just: (226711 238899 382015 * 439844 )Therefore something to:
faker.phoneNumber().cellPhone([2-4]#-##-##)
faker.phoneNumber().phoneNumber([2-4]#####)
Thus I am not sure if is possible (if yes - how can be configured?) and if not, consider add this feature
Thanks for your understanding