title: Finding array element within a string C#
body: <p>I've been looking for a way to check a string for elements of an array and if it contains one of those elements to return the indexOf it but i'm having trouble finding a way to do this. Most of my searches end up showing me way to find the indexOf an element in an array or something similar.</p>
  
  <p>As a bit of background I'm trying to create a program that takes a string from user input, splits the words of the paragraph into an array, performs certain checks on them and changes them accordingly. </p>
  
  <p>For instance if the current word starts with a consonant it finds the first vowel and moves all the letters in front of it to the end of the word. This is what I tried but it prints an index of 14 so clearly something is wrong:</p>
  
  <pre><code>char[] vowelsList = new char[] { 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u' };
  
  foreach (char vowel in vowelsList)
  {
      if (currentWord.Contains(vowel))
      {
          int index = currentWord.IndexOf(vowel);
          System.Diagnostics.Debug.Write(index);
      }
  }
  </code></pre>
  
  <p>currentWord is the word from the string from the user input that is currently being checked.</p>
  
  <p>Any suggestion on different methods or keywords to try is appreciated. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I apologise the code is actually fine, it was returning 1 and 4 because it was always receiving the input Hello and i was misinterpreting what was going on, I'm a bit of an idiot sometimes. I guess then my question would be how to get this code to only find the index of the first vowel but a poster has already stated how to do that, thank you all for the help and suggestions, most of which I have implemented.</p>