split() function problem.
Hi guys. I'm trying to develop a small program for my final year project at university, but am having some issues with the split function.
What I'm attempting to do is split a sentence into its composite words, each one being held in an array, which is then compared in turn against a list of words in another array.
My problem comes when I attempt to compare words that come at the end of a sentence or before a comma. I want to split the words whilst also removing any such punctuation. Can you suggest a way of doing this? Currently my splitting function looks like this:
for (int i = 0; i < sentences.length; i++)
//Split the string into its seperate elements
holdingString = sentences[i];
words = holdingString.split(" ");
Thanks for the help.