String readPOS;

		readPOS = jTextArea1.getText();

		String []POS;
		POS = readPOS.split("[-.!? ,\n]");

        jTextArea2.append("Part of Speech Result:\n");
        String patternKGN,patternKPF,patternKK,patternKNA,patternKPA,
        patternKPC,patternKPK,patternKS,patternKNK;

		for(int i = 0; i < POS.length; i++)
		{
                if (POS[i].equals(POS[i].toUpperCase()))
                {
                        jTextArea2.append(POS[i].toUpperCase() + "/KNK" + " | ");
                }
}

i ady split the input with "[-.!? ,\n]", for example when i
input :
DENNIS, MAY! CARRICK?

Output : DENNIS/KNK | /KNK | MAY/KNK | /KNK | CARRICK/KNK | /KNK |

the result like detect "[-.!? ,\n]" after spacing become as uppercase, if no put spacing after "[-.!? ,\n]" then

Output :
DENNIS/KNK | MAY/KNK | CARRICK/KNK |

This result is wat i wish... but after put back spacing.. become problem as mention jz now... who can fix?

Your description is a little bit difficult to understand, but I think you are saying the extra spaces are causing you trouble in the split() result? You can make it ignore those by altering your pattern to allow for one or more occurrences of those characters. Try this "[-.!? ,\n]+" for your split pattern.

Your description is a little bit difficult to understand, but I think you are saying the extra spaces are causing you trouble in the split() result? You can make it ignore those by altering your pattern to allow for one or more occurrences of those characters. Try this "[-.!? ,\n]+" for your split pattern.

Thanks... you helping me alot.. in this project. i learned more in Java.. Thanks.. i will put more effort in java..

This question has already been answered. Start a new discussion instead.