title: Reading each word from Email addresses in Java
body: <p>I have an email address as a <code>String</code> and from that I have to find certain words if Email is containing. I have to find the words before, after and, in between based on these:-</p>
  
  <p><strong>. , @ , - , _</strong>  .</p>
  
  <p>My Code:</p>
  
  <pre><code>String s = "asdfgabc@gmail.com";
  String var = null;
  for(int i = 0; i &lt; s.length(); i++)
  {
      char c = s.charAt(i);
      var+=c;
      if(var.contains("@") || var.contains(".") || var.contains("-") || var.contains("_") ){
          //System.out.println(var);
      }
      else{
          var+=c;
          System.out.println(var);
      }
  }
  </code></pre>