Greetings All;
I have a LinkedList of type String which contain some words like [from, to, in, then, however]
and I have a text file which contain long sentences.
what i want to do is to split those sentences in shorter sentences when one of the above words is found.
what I have did so far that I made a linked list that contains the words, and another linked list that contain the long sentences in the file.
I don’t know how to split the long sentence?
I have tried this:
int indexofsw = 0;
for (int k = 0; k < LongSentence.size(); k++) {
for (int j = 0; j < SWords.size(); j++) {
if (LongSentence.get(k).contains(SWords.get(j))== true) {
indexofsw = LongSentence.get(k).indexOf(SWords.get(j));
System.out.println(LongSentence.get(k).substring(k,indexofsw));
break;
}
}
}
but it doesn’t returns a shorter sentence.
Any Ideas please?
test.java, to get you started:
output: