parse International
fun parseInternational(raw: String, fallbackCountry: Country): PhoneNumberFormatter.ParsedNumber(source)
Splits a pasted or prefilled string into the country it belongs to and its national digits.
Handles the three shapes users actually paste:
full international (
"+254712345678") — country resolved from the calling code;international with separators (
"+254 712 345 678") — separators ignored;bare national (
"0712345678") — no country information, so fallbackCountry is kept and the digits are returned as-is.
When the calling code is shared (+1, +44), libphonenumber's own region inference decides which country it is from the number itself — that is why this delegates to parse rather than matching dial-code prefixes by hand.
Return
The resolved country (or fallbackCountry) and the national digits.