Sam Gildea Sam Gildea - 4 months ago 16
Java Question

Write method that puts the word "like" in between each of the words in the original sentence

I need to write a method that puts the word "like" in between each of the words in the original sentence.

For example:

teenTalk("That is so funny!")

would return "That like is like so like funny!"

Would you use sentence split for this?

Answer

You can replace the space character with "like":

text.replace(" ", " like ");