Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Re: How to find all the words of a certain length in a String and return them.

    You are welcome.
  2. Re: How to find all the words of a certain length in a String and return them.

    I am glad you have it working now.
  3. Re: How to find all the words of a certain length in a String and return them.

    What happened with that code?
  4. Re: How to find all the words of a certain length in a String and return them.

    The variable should be declared in the wordsOfLength method, just like the split variable. That is where it is filled and returned.
    Using global static variables is a bad solution.
  5. Re: How to find all the words of a certain length in a String and return them.

    savedWords is a new String that will be filled with the found words and returned by the method that finds the words.
    The newWord is what is found in the search for the word that has the desired...
  6. Re: How to find all the words of a certain length in a String and return them.

    Build a String with the words separated by spaces: savedWords += newWord + " "
    Return that String to the caller.
  7. Re: How to find all the words of a certain length in a String and return them.

    How are the word supposed to be returned?
    All in one String separated by spaces
    In an array(or ArrayList) of Strings
    One String at a time requiring that the method be called one time for each...
  8. Re: How to find all the words of a certain length in a String and return them.

    Ok, what does the program need to do with the word it finds? Look at the reason the program is being written:

    When the program finds a word, what does it need to do?
  9. Re: How to find all the words of a certain length in a String and return them.

    What is the program counting? What is 11 a count of?

    What should the program do when it finds a space?
  10. Re: How to find all the words of a certain length in a String and return them.

    Ok start with that one. How should the program do that?
    In the code: where is the length of the first word saved? Did you print it out to see if it was correct?
  11. Re: How to find all the words of a certain length in a String and return them.

    How are you trying to debug the code to see what it is doing?
    Add some print statements that print out the values of variables as they are changed and used
    and also to see where the code's...
Results 1 to 11 of 11