Re: Need help in comparing the string words in two arrays.



learner9 wrote:
String[] arrAbstractText = txtAbstract.split("\\ ");
boolean match = false;
for (int k = 0; k < arrAbstractText.length; k++) {
for (int l = 0; l < stopWords.length; l++) {
s = String.valueOf(arrAbstractText[k]).trim();
if(s.length()>0 &&
stopWords[l].trim().equals(s.toLowerCase())){match=true;}
}
if (!match) {
vFWords.add(arrAbstractText[k].toString().toLowerCase());
System.out.println("Words do not match :" +
arrAbstractText[k].toLowerCase().trim());
}
}

I think this line
> boolean match = false;
should be put inside the first loop instead?

Also, it might be better to use equalsIgnoreCase() instead of equals()
.