Can u tell me how to check whether a string containing some word.
eg.
This is a ball.
I want to check wheter this string contain word 'ball'.
how to write the code?
I have to to write the code but it cannot go to the if (previous.contains("ball")) statement. I also try method matches() and endWith() but also cannot. I use endWith because the word i want to check is the end of the string. Did I use the wrong method?
while (iter.isValid()) {
FeatureStructure fs = iter.get();
if (fs.getType().getName().equals("com.ibm.uima.examples.tokenizer.Sentence")){
if (fs instanceof AnnotationFS) {
AnnotationFS annot = (AnnotationFS)fs;
String coveredText = annot.getCoveredText();
if (previous.contains("ball"))
System.out.println("hit\n");
sentenceCount = sentenceCount + 1;
previous = coveredText;
}
iter.moveToNext();
}
else
iter.moveToNext();
}
sentenceCount = 0;
}