simplifyString()function
simplifyString(str: string): string
| Param | Type | |
|---|---|---|
str | string | The string to simplify. required |
| Return | |
|---|---|
string | The simplified, lowercased string containing only numbers, letters, and single spaces. |
Simplify a string by removing anything that isn't a number, letter, or space.
- Normalizes the string by
- Useful when you're running a query against a string entered by a user.
@todo Convert confusables (e.g. ℵ alef symbol or ℮ estimate symbol) to their letterlike equivalent (e.g. N and e).
Examples
simplifyString("Däve-is\nREALLY éxcitable—apparęntly!!! 😂"); // Returns "dave is really excitable apparently"