Home > @wixc3/common > splitIntoWords
Breaks down a string to words, dropping non letters and numbers
Signature:
splitIntoWords: (str: string) => string[]
Parameter | Type | Description |
---|---|---|
str | string |
Returns:
string[]
An array of words contained in str
splitIntoWords("Hello world") // => ["Hello", "world"]
splitIntoWords("Hello123world") // => ["Hello", "123" "world"]
splitIntoWords("Hello WRL") // => ["Hello", "WRL"]
splitIntoWords("HelloWorld") // => ["Hello", "World"]
splitIntoWords("Hello_world--") // => ["Hello", "world"]