title: Check if there is a consonant in a string in java
body: <p>So I am writing a program that is the game called pig latin (You can check Wikipedia for the rules, but it consits of taking the first consonants and moving them to the back of the word and adding -ay). I need to check the word has any consonants in the beginning of the word . If it has a or more consants the it needs to get the substring starting at the first consonant and ending at the last consonant before a vowel.</p>
  
  <pre><code>public void isConsonant(String word){
      char[] consonants = {'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm'
              , 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z' };
      char[] StringArray = word.toCharArray();
      for(int dex = 0; dex &lt; StringArray.length; dex++ ){
          char current = StringArray[dex];
      }
  }
  </code></pre>
  
  <p>Here is an example:</p>
  
  <p>The word 'glove' should become oveglay . My program outputs 'lovegay'.</p>
  
  <p>Here is my program (minus <code>imports</code> and <code>GUI</code> stuff):   </p>
  
  <pre><code>public class PigLatin extends JFrame implements ActionListener {
      JTextField word = new JTextField(25);
      JButton GO = new JButton("Go");
      JLabel output = new JLabel();
      String CharNum1;
      String CharNum2;
  
      //The frame setup should be here
  
      public void isConsonant(String verify) {
          char[] consonants = { 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm',
                  'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z' };
          char[] StringArray = verify.toCharArray();
          for (int dex = 0; dex &lt; StringArray.length; dex++) {
              char current = StringArray[dex];
          }
      }
  
      public void game() {
          // The actual word
          String word2 = word.getText();
  
          // The first character
          CharNum1 = word2.substring(0, 2);
          CharNum2 = word2.substring(1, word2.length());
  
          // Remove the first char
          // String RevampedWord = word2.replace(CharNum1, "");
          String finalWord = CharNum2 + "-" + CharNum1 + "ay";
          output.setText(finalWord);
      }
  
      public void actionPerformed(ActionEvent event) {
          game();
      }
  
      public static void main(String[] arguments) {
          PigLatin pig = new PigLatin();
      }
  }
  </code></pre>
  
  <p>So my question is weather it is possible to see if a String contains consonats and make a substring of the first consonant to the first consonant before a vowel.</p>
  
  <p>Thanks in advance. </p>