Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Replies
    15
    Views
    1,049

    Re: Hangman multiple letters

    Maybe tomorrow the light will come on.
  2. Replies
    15
    Views
    1,049

    Re: Hangman multiple letters

    I used the word column as if the String were a row made up of columns. The first column is the first position in the String at index=0.
  3. Replies
    15
    Views
    1,049

    Re: Hangman multiple letters

    Since the code needs to continue looking for a letter until it is not found, code would need a loop.
    You could use a 0 for the starting column for the indexOf() search for the first search.
  4. Replies
    15
    Views
    1,049

    Re: Hangman multiple letters

    Something like this:
    find first one and save the column: int ix = str.indexOf("a")
    look for the next one starting at that saved column+1
    int ix2 = str.indexOf("a", ix+1);
  5. Replies
    15
    Views
    1,049

    Re: Hangman multiple letters

    You need to save the last value returned by indexOf to use in the next search.
    If you find the first "a" at 1, then start the next search for an "a" at 2
  6. Replies
    15
    Views
    1,049

    Re: Hangman multiple letters

    There is another version of the indexOf() method that will start its search at another column besides column 0.
    Use that version with the column past where the last match was found. If found at 8...
Results 1 to 6 of 6