
Loading


The SanitizePhoneNumber function takes a phone number as input and removes all non-numeric characters. It uses Split to break the string into individual characters, IsMatch to filter digits, and Concat to reassemble the cleaned number.
// Function to sanitize a phone number by removing non-numeric characters
SanitizePhoneNumber(PhoneNumber: Text):
Text = Concat(
ForAll(
Split(PhoneNumber, "") As val,
If(
IsMatch(val.Value, "[0-9]", MatchOptions.Complete),
val.Value,
""
)
),
Value
);
Set(CleanedPhoneNumber, SanitizePhoneNumber(gblSelectedContact.Phone));
The SanitizePhoneNumber function removes all non-numeric characters from a phone number, returning only the digits. It processes the input string character by character, retains only digits, and returns a sanitized string containing only numeric values.
The variable CleanedPhoneNumber will contain only the numeric characters from the input gblSelectedContact.Phone.
This function is ideal for: