core3-utils

@wixc3/common on Github

Home > @wixc3/common > splitIntoWords

splitIntoWords() function

Breaks down a string to words, dropping non letters and numbers

Signature:

splitIntoWords: (str: string) => string[]

Parameters

Parameter Type Description
str string

Returns:

string[]

An array of words contained in str

Example

splitIntoWords("Hello world") // => ["Hello", "world"]
splitIntoWords("Hello123world") // => ["Hello", "123" "world"]
splitIntoWords("Hello WRL") // => ["Hello", "WRL"]
splitIntoWords("HelloWorld") // => ["Hello", "World"]
splitIntoWords("Hello_world--") // => ["Hello", "world"]