String subTopicsArray [] = detail.split("\\. ");
StringBuffer splitTopic开发者_StackOverflows = new StringBuffer();
for(int i=0; i<subTopicsArray.length; i++){
String abc=subTopicsArray[i].trim();
if (abc.length() > 0)
{
splitTopics.append(i+1+") "+subTopicsArray[i].trim()+"."+"\n" );
splitTopics.append("\n");
}
Am using this but am getting two dots for last sentence
use StringTokenizer with deliminator "."
For Example:
StringTokenizer st = new StringTokenizer(detail);
while(st.hasMoreTokens())
{
st.nextToken();
}
精彩评论