Version: v0.8.1 - Beta.  We welcome contributors & feedback.

String.splitWords

splitWords($options={}) -> list

Description

Split into a List of words, separated by whitespace (newlines and spaces).

Non-alphanumeric characters are removed unless $options is -keepAllChars.

'Deer Snail Sparrow'.splitWords()
//= ['Deer', 'Snail', 'Sparrow']

'Yes, this is a phrase.'.splitWords()
//= ['Yes', 'this', 'is', 'a', 'phrase']

'Yes, this is a phrase.'.splitWords(-keepAllChars)
//= ['Yes,', 'this', 'is', 'a', 'phrase.']

See Also