Filter()
Category: Text
Syntax: Filter ( textToFilter; filterText ) |
Parameters:
textToFilterAny expression that resolves to a text string.
filterTextThe characters to preserve in the specified text.
Data type returned: Text
Description:
Strips from textToFilter all the characters not explicitly listed in filterText. All remaining characters are returned in the order in which they exist in textToFilter, including duplicates. If filterText doesn't have any characters, an empty string is returned, as opposed to a question mark. The Filter() function is case sensitive.
The Filter() function is frequently used to ensure that users have entered valid data into a field. The textToFilter parameter should contain any valid characters; the order of the characters within textToFilter isn't important.
Examples:
Function |
Results |
---|---|
Filter ( "ab123"; "abc" ) |
Returns ab. |
Filter ( PhoneNumber; "0123456789" ) |
Would strip any non-numeric characters from the PhoneNumber field. |