I want to use whitespace as a delimiter in a split function call, but there are certain words that I want to enter into a single cell array; such as ma kore.
For example:
String str = "azx cd ma kore cfg ma kore dfgh";
And after the function split call with some delimiter the output should look like this:
str[0] = "azx"
str[1] = "cd"
str[2] = "ma kore"
str[3] = "cfg"
str[4] = "ma kore"
str[5] = "dfgh"
I need to find a delimiter (or regex pattern) to use in the split function. How do I go about doing that?
Use regex pattern
and find all matches/occurrences.