This section illustrates you how to split String data (separated by "," or "and/or"). These words are shown in a new line without the word or characters which is used for separation the word of the sentences through the given regular expression of the fol
This section illustrates you how to split String data (separated by "," or "and/or"). These words are shown in a new line without the word or characters which is used for separation the word of the sentences through the given regular expression of the folThis section illustrates you how to split String data (separated by "," or "and/or"). These words are shown in a new line without the word or characters which is used for separation the word of the sentences through the given regular expression of the following program.
Program Result:
This program takes a complete string or text with the many separation of words and detects every comma, and|or separation from the given sentences. It besides all word or the collection of words from where the comma or and|or separation is used. The complete separate word is shown in a new line.
Code Description:
String[] str = string.split("[, ]+(and|or)*[
]"):
Above code splits the value of String type variable string
with the ","(comma), " ", "and" or "or"
separators and store it into a String array str which value is shown by
the following program one-by-one.
Here is the code of the program:
import java.util.regex.*;
|
Ads