Discount code for tennis channel plus

Get first two words from string java

With a loop, and a char-testing algorithm, we can extract the first N words from a string. We use substring () to extract the first part from the text. For. An example. Here is the firstWords method. This method receives two arguments: the string we want to get the first words from, and the number of words to extract. It uses a for-loop.