Category: Text function
This function keeps only the characters given in keep_string and removes the others from text.
|text||Text||The text value to search within for the after_string string.|
|keep_string||Text (must not be empty)||A string of individual characters within text to keep, removing all other characters.|
Return value type: Text
This function is case sensitive.
text and keep_string are implicitly converted to text values if required.
The retained characters appear in the result in the order they appear in text.
If none of the characters in keep_string are found, an (empty) value is returned.
keepchars('a1b2c3', 'abc') //Returns 'abc'
keepchars('a1b2c3', 'cba') //Returns 'abc'
keepchars('3b2d1', '123') //Returns '321'
keepchars('Canada', 'acx') //Returns 'aaa' ('C' not kept due to case mismatch; no 'x' in 'Canada')
keepchars('Canada', 'Ca') //Returns 'Caaa'
keepchars('Canada', 'zxw') //Returns (empty) ('z', 'x', nor 'w' are found in 'Canada')