Created
December 20, 2021 15:43
-
-
Save Oleur/86f3558843cccdff84d5ddac5e4280f5 to your computer and use it in GitHub Desktop.
Phone number formatting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s.forEachIndexed { index, char -> | |
if (PhoneNumberUtils.isNonSeparator(char)) { | |
if (lastNonSeparator.code != 0) { | |
formatted = getFormattedNumber(lastNonSeparator, hasCursor) | |
hasCursor = false | |
} | |
lastNonSeparator = char | |
} | |
if (index == curIndex) { | |
hasCursor = true | |
} | |
} | |
if (lastNonSeparator.code != 0) { | |
formatted = getFormattedNumber(lastNonSeparator, hasCursor) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment