How can we validate the length of a mobile number by COUNTRY? (Knowing that the country code might or might not be part of the number)
Length may vary per country, meaning there should be a length range or pattern validator.
Example:
- +1 222 2222 222 (13 digits) Valid ✔️
- 222 2222 222 (12 digits) Valid only if chosen in corresponding Locale ✔️
- +1 222 2222 2222222 (17 digits) Invalid ❌
- +1 222 2222 (8 digits) Invalid ❌
Note: Any idea where can I find each country's mobile number length range.
Thank you!
Kotlin answer