0.0.0 • Published 2 years ago
@zzzzbov/split-into-words v0.0.0
split-into-words
splitIntoWords
splits a string into an array of words, numbers, and individual punctuation marks. This is useful as a utility for transforming letter casing to various different formats.
"Words" are defined as runs of lowercase letters, uppercase letters, or a single uppercase letter followed by lowercase letters.
"Numbers" are defined as runs of digits.
All other characters (such as punctuation marks) will be split into individual entries in the resultant array.
Examples
Example | Result |
---|---|
"Hello, World!" | ["Hello", ",", " ", "World", "!"] |
"camelCase" | ["camel", "Case"] |
"PascalCase" | ["Pascal", "Case"] |
"kebab-case" | ["kebab", "-", "case"] |
"snake_case" | ["snake", "_", "case"] |
"HTTPRequest" | ["HTTP", "Request"] |
0.0.0
2 years ago