The question might look confusing. Here I explain it. I have a single line in a file containing
"This is the line. containing several sentences .and it is not well formatted."
I want this in sentences according to "."
as
This is the line.
containing several sentences.
and it is not well formatted.
I have tried using
String line = "This is the line. containing several sentences .and it is not well formatted.";
String[] lineArr = line.split(".");
for(String sentence:lineArr){
System.out.println(""+sentence);
}
}
My idea is to removing the spaces before and after "."
and then applying split().
How should I achieve this?