Aaaaaaarrrrrrrrrrghhhhhhhhhhhhhhh!!!

Hi folks;
I am in the process of creating a spell checker program that reads in text and returns the corrected text including any amendments made by the user.
public String checkText(String textToCheck){
/*this method checks the text that has been passed in until it encounters an error or until there are no more words to check */
StringTokenizer tok = new StringTokenizer(textToCheck);
//breaks up the string into a series of tokens, or words separated by spaces
boolean noMistakes = true;                    //Assume that no mistakes have been found in the text
boolean wordFound;                                        //variable indicating whether or not the word is contained in the dictionary
while (tok.hasMoreTokens() && noMistakes==true) {//open while loop
currentToken = tok.nextToken();
//System.out.println(currentToken);
if (! Character.isDigit(c)) {// ignore numbers
wordFound = contains(currentToken);//is the word contained in the dictionary
if (wordFound == false) {//checks the dictionary for the existence of that word
     noMistakes=false;
     //display an error message
     String errorMessage = (processedString + " has not been found in the dictionary");
     resultField.setText(errorMessage);     
     //highlight the mis-spelt word
     //get a list of suggestions for the misspelt word     
}//close while loop
     if (noMistakes==true){
          resultField.setText("Finished checking text. No errors found.");          
          //display error message once there is no more text to check
     return textArea.getText();
}//end procedureHowever, this procedure returns a string when the program encounters an error, rather than when the text has all been checked.
Has anyone any suggestions so that I can amend this program so that it returns a value only when all the text has been checked, rather than when the first error is encountered please.
Thanks and regards,
Sean

every opening bracket { should have a corresponding closing bracket }. in your code this is not the case. first if - where's the closing bracket? then you are closing th while loop (as you say in the comment), but in fact this is an if you are closing

Similar Messages

Maybe you are looking for

  • Need mailto: links in Word docs to open both *in Gmail* and *IN FIREFOX* how?

    I have several "how to" documents at work that I've created to help make remembering the details of certain tasks easier. For several of these, I've got a mailto: link to some contact person which also has a subject line pre-filled with our account n

  • How do I move pages within a document?

    I have a manual I created for work and I want to reorder the pages. I want a move a section to the beginning but when I try to move the pages, it moves multiple pages at once. There is a yellow box surrounding the pages affected. I don't know how to

  • RDP from internet not working in Hyper-v VMs

    Hello . Sorry for my english .I hope to explain clearly my problem . I 've Hyper-v on Windows 2008 server r2 . I've 3  Virtual networks ( External , Private and internal ) . In my VMs there are two domains . The first one is bound with internal Vn an

  • Re : about ALV Reporting

    hi all,    what are the events in alv reporting? Thanks in advance.

  • Updates suppressed by administrator

    Same problem as above posts.  I tried uninstalling and re-installing AfterEffects CS6, but still the same problem; CS6 wont open, and when I try to run the 11.0.3 AdobePatchInstaller, it gives me the following message (which is eroneous, since I am l