Check if one letter is in a string(word), and what posistion it is at?
<p>I have one method with one letter(string\char?) as argument and one word active at a time. I would like to see if this one letter, is in the word which is active at the time.</p>

<p>That could probably have been explained better. Maybe code will do the trick:</p>

<pre><code>public void checkLetter(String letter){
        for(int i = 0; i&lt;activeWord.length(); i++){
            if(letter.equals(activeWord.[i])){
                // Run a method which gives the user a correct letter pushed.
                }
                else {
                    String failed = "Could not find the letter in the active word.";
                    // Run a method which gives the user one wrong letter pushed.
                }
            }           
    }
</code></pre>

<p>So, this is going to be a hangman game for android i'm making for fun. Right now i have images as letters. When the letter(image) is pressed, this method runs, and the letter pushed will be the argument.</p>

<p>Does anyone have any good ideas how i can find out if the letter is in the word, and which posistion it is in?</p>

<p>I would love some help :)</p>

<p>EDIT: Btw, the current code returns int every time ofc, cause the [i] is an int. This is where im strugling to get the code to return a string. Do i have to split the word up into letter before i can equal them to another string?
Thanks.</p>
