clean()
Usage
clean(string)
Description
This method can be used to convert complex strings (e.g. user names, article titles, etc.) into simple strings that can be used in URLs etc.
Characters | Action |
---|---|
Whitespace | Replace with- |
–'+/|\` |
Replace with- |
Uppercase letters | Replace with corresponding lowercase letter |
<>.?(){}[]!, |
Remove |
Note
- Strings are normalized in the NFD form (see. http://www.unicode.org/reports/tr15/tr15-23.html)
- Multiple replacements are collapsed into a single
-
Example
${clean('This is an example string')}
${clean('Süperpöwer')}
results in
this-is-an-example-string
superpower