I am using Java, i need your opinion on how to write better code for the following task.
I have following String value
String testStr = "INCLUDES(ABC) EXCLUDES(ABC) EXCLUDES(ABC) INCLUDES(ABC) INCLUDES(ABC)"
I want to manipulate Strings and want to combine all INCLUDES statements into one INCLUDES and the result should be similar to the following:
INCLUDES(ABC,ABC, ABC) EXCLUDES(ABC, ABC)
I have wrote down small utility result as following
Following is my java codeas following please take a look and if any one can improve it please feel free.