title: Java - Variable Check if Contains
body: <p>I think what I want to do is rather simple, but not sure.  I'd like to do this in the easiest way as I have multiple different variables I want to apply this to.  I want to search if a variable contains a certain word or words and then if it does set a new variable.  For example if someone signs up for email and they have Gmail, I want to set a new variable for use later.  I'm self taught and obviously new to java and would appreciate any feedback.  Thanks.</p>
  
  <pre><code>if (email == "*@gmail.com") 
  {
      var mailtype = "gmail"
  };
  </code></pre>
  
  <p>Another example would be to verify email address format:</p>
  
  <pre><code>if (email == "*@*.*") 
  {
      var mailformat = "okay"
  };
  </code></pre>