Skip to content

Instantly share code, notes, and snippets.

@autumnharmony
Created November 29, 2012 19:08
Show Gist options
  • Save autumnharmony/4171172 to your computer and use it in GitHub Desktop.
Save autumnharmony/4171172 to your computer and use it in GitHub Desktop.
Indexes of all occurrences of character in a string
for (int index = word.indexOf(guess);
index >= 0;
index = word.indexOf(guess, index + 1))
{
System.out.println(index);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment