title: Counting Vowels in Swift
body: <p>I have done this successfully in Java and C++ but can't figure it out in Swift. Here is my C++ code: </p>
  
  <pre><code>int count_vowels (string input)
  {
    int position = 0;
  
    for (int i = 0; i &lt; input.length(); i++)
      {
      char ch;
      ch = input[i];
  
        if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'){
            position++;
        }
  
    }
    return position;
  }
  </code></pre>
  
  <p>Again I'm just trying to iterate through a string, counting the values that are true in the if statement and returning the position(how many there are). </p>
  
  <p>Is there any way to convert this to swift syntax. </p>
  
  <p>I figured it out: </p>
  
  <p>for char in vowels.characters{</p>
  
  <pre><code>            if char == ("a") || char == ("e") || char == ("i") || char == ("o") || char == ("u") {
  
                  count++
              }
      }
  </code></pre>
  
  <p>Thanks everybody for there help and posts I was pulling my hair out on this one. </p>
  
  <p>Thanks again</p>