Splitting Strings into Words

Learn how to split strings into words with the help of examples.

We can now split arbitrary strings into an array of lines, bringing us to our next logical step: breaking strings into lists of words. A word’s concept and exact definition can easily lead us astray and into a separate discussion. With this in mind, we will say that a space—or the other arbitrary characters that we define—separates a word.

Press + to interact
Splitting a string into words using spaces
Splitting a string into words using spaces

The first method we will create ...