Split string into sentences based on periods

Posted by rookie on Stack Overflow See other posts from Stack Overflow or by rookie
Published on 2010-04-21T22:29:34Z Indexed on 2010/04/21 22:33 UTC
Read the original article Hit count: 202

Filed under:
|
|
|
|

Hi all,

I have written this piece of code that splits a string and stores it in a string array:-

String[] sSentence = sResult.split("[a-z]\.\s+");

However, I've added the [a-z] because I wanted to deal with some of the abbreviation problem. But then my result shows up as so:-

Furthermore when Everett tried to instruct them in basic mathematics they proved unresponsiv

I see that I loose the pattern specified in the split function. Its okay for me to loose the period, but loosing the last letter of the word disturbs its meaning. Could some one help me with this and in addition also could someone help me with dealing with abbreviations? Like because I split the string based on periods, I do not want to loose the abbreviations.

Thanks in advance

© Stack Overflow or respective owner

Related posts about java

Related posts about split