I am having a long text which i want to split in to small sentences.The following is my text.
I tried Count words in a string method? but there the solution given was to split the string return trim.split("\\s+").length;. In my text i don't have any spaces.
సోషలిజం,అనే,మాటను,గబ్బు,పట్టించడమే,కాంగ్రెసు,వారి,వ్యూహమనీ,అంతవరకూ,ప్రజలలో,సోషలిజం,యెడవున్న,అభిమానాన్ని,ఎక్స్ప్లాయిట్,చెయ్యడం,దాని,ఎత్తుగడ,అనీ,అంటే,ఓ,మాటు,నా,మీద,పడిపోయావు,గుర్తుందా.
I know split() is used to split the string. But i don't know how to split above text as there is no space or any other regular expression to split with.
The following code works for splitting the text
String string = "1234,56,789,10,1111111,1111112,12";
char[] ch = string.toCharArray();
int comma_limit = 3;
int comma_count = 0;
for(int i=0;i<ch.length;i++)
if (ch[i] == ',') {
comma_count = comma_count + 1;
if (comma_count % comma_limit == 0)
{
ch[i] = '.';
System.out.println(ch);
}
}