Package-level declarations

Functions

Link copied to clipboard

Strips all non-digit ASCII characters from a phone number string. Example: "+1 (800) 555-0199".digitsOnly() → "18005550199"

Link copied to clipboard

Formats a phone number with a custom separator pattern. Example: "0612345678".formatPhonePattern("XX XX XX XX XX") → "06 12 34 56 78" (French style)

Link copied to clipboard

Formats a 10-digit US phone number as "(XXX) XXX-XXXX". Returns the original string if it cannot be parsed. Example: "8005550199".formatUsPhone() → "(800) 555-0199"

Link copied to clipboard

Returns true if the string looks like a valid 10-digit US phone number. Example: "(800) 555-0199".isValidUsPhone() → true

Link copied to clipboard
fun String.maskPhone(visible: Int = 4): String

Masks a phone number, showing only the last visible digits. Example: "8005550199".maskPhone(4) → "******0199"

Link copied to clipboard
fun String.toE164(countryCode: String = "1"): String

Formats a phone number in E.164 international format. Assumes +1 country code if none provided and digits length is 10. Example: "8005550199".toE164() → "+18005550199"

Link copied to clipboard

Returns a tel: URI for use in links and intents. Example: "+18005550199".toTelUri() → "tel:+18005550199"