phonenumber
0.1.0indexedGlobal phone-number validation, region and country-code checks, E.164/international formatting, region/calling-code extraction and structured parsing — built atop native parsing libraries for accurate results.
Global phone-number validation, region and country-code checks, E.164/international formatting, region/calling-code extraction and structured parsing — built atop native parsing libraries for accurate results.
A Kotlin Multiplatform phone number validation library for Android and iOS.
Maven Central publishing will be added once the library is publicly released.
dependencies {
implementation("com.ajayinnovations.phonenumber:phonenumber:0.1.0")
}
val isValid = PhoneNumberValidator.isValid("+2348012345678")
val isValidForRegion = PhoneNumberValidator.isValidForRegion(
phoneNumber = "+2348012345678",
regionCode = "NG"
)
val isValidForCountryCode = PhoneNumberValidator.isValidForCountryCode(
phoneNumber = "+2348012345678",
countryCode = 234
)
val e164 = PhoneNumberValidator.format(
phoneNumber = "+2348012345678",
format = PhoneNumberFormat.E164
)
val international = PhoneNumberValidator.format(
phoneNumber = "+2348012345678",
format = PhoneNumberFormat.INTERNATIONAL
)
val regionCode = PhoneNumberValidator.regionCode("+2348012345678")
val countryCode = PhoneNumberValidator.countryCode("+2348012345678")
val info = PhoneNumberValidator.parse("+2348012345678")
PhoneNumberValidatorMain entry point for:
PhoneNumberFormatSupported output formats:
E164INTERNATIONALPhoneNumberInfoStructured parsed phone number data containing:
This library uses different underlying implementations per platform:
libphonenumberPhoneNumberKit through a wrapper bridgeThis keeps the public API shared while using strong platform-specific parsing and formatting underneath.
This library is currently in active development and pre-release.
Apache License 2.0
Surfaced from shared tags and platforms — no rankings paid for.