I never cease to be amazed at the B4X products and community and have finally found a way to repay some of the support I have received over the last couple of years.
The fact I also need this functionality is beside the point
Never done a library before but seeing as how no one else seems willing to bring this thread to its logical conclusion I thought I'd give it a go.
Simply by installing SLC and joining the dots in the above posts I have come up with the following little library.
Usage:
Private Sub Process_Globals
Private Obj_phonevalidator As PhoneValidator
End Sub
Private Sub FOO_sub(phoneno As String)
Private good_no as Boolean = Obj_phonevalidator.Validate(phoneno, "AU")
End Sub
AU is the default country code - always uppercase, AU = Australia, US = ...
If you specify a default country code then you can test phone nos using the nomenclature internal to that country.
If you set default country code to "" then all phone nos to be tested must be in E.164 format (
https://en.wikipedia.org/wiki/E.164) otherwise result will be false.
You must also install libphonenumber-8.9.7.jar (as at writing - the latest and greatest) to your B4A additional libraries folder, I got it from:
https://mvnrepository.com/artifact/com.googlecode.libphonenumber/libphonenumber/8.9.7
Enjoy...