Intention is to take a current line (String that contains commas), replace white space with \"\" (Trim space) and finally store split String elements into the array.
If you need to perform this operation repeatedly, I'd suggest using java.util.regex.Pattern
and java.util.regex.Matcher
instead.
final Pattern pattern = Pattern.compile( regex);
for(String inp: inps) {
final Matcher matcher = pattern.matcher( inpString);
return matcher.replaceAll( replacementString);
}
Compiling a regex is a costly operation and using String's replaceAll repeatedly is not recommended, since each invocation involves compilation of regex followed by replacement.