Re: Need help in comparing the string words in two arrays.
- From: Trung Chinh Nguyen <chinhnt2k3@xxxxxxxxx>
- Date: Sat, 29 Apr 2006 22:58:14 GMT
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()
.
- Follow-Ups:
- Re: Need help in comparing the string words in two arrays.
- From: learner9
- Re: Need help in comparing the string words in two arrays.
- References:
- Need help in comparing the string words in two arrays.
- From: learner9
- Need help in comparing the string words in two arrays.
- Prev by Date: Re: Need help in comparing the string words in two arrays.
- Next by Date: Re: JOptionPane blank message after first time
- Previous by thread: Re: Need help in comparing the string words in two arrays.
- Next by thread: Re: Need help in comparing the string words in two arrays.
- Index(es):