String Manipulation - Example 4

This is another way of doing Example 3, achieved using replace() rather than split(). Does it produce exactly the same results as the program in Example 3. Try different text sentences and judge for yourself.

Please enter a piece of text into the text slot below and I will split it into words and display it on the screen.