cleaned to store digits only.number and append only digit characters to cleaned.formatted to store the final phone number.cleaned string:
cleaned is greater than 4, take the first 3 digits, append them to formatted, and remove them from cleaned.cleaned is exactly 4, split it into two blocks of 2 digits, append them to formatted, and break the loop.cleaned is less than 4, append the remaining digits to formatted and break the loop.formatted string.