title: Java - how can i remove a word after using a special symbol
body: <p>How can i delete a word which is followed by a special character ( # )? Ex: From a phrase: Eva have green#eyes I would like to delete the word "green" (Eva have eyes), that is the word that ends on a space.</p>
  
  <p>Also I have problem with deleting the whole line that is followed by @,</p>
  
  <p>ex: <code>Eva have green@eyes</code> ---> and should be "<code>eyes</code>"
  my code (I have no idea haw can I complete it):</p>
  
  <pre><code>class Stack {
  
  public Stack() {
      del = '&amp;';    //that method deletes only one character
                    //ex: ab&amp;cd ---&gt; acd
      destroy = '@';
      delWord = '#';
      stack = new Stack&lt;Character&gt;();
  
  }
  
  public void methods(String string)
  {
  
      for (int i=0; i&lt; string.length(); i++) //that method deletes only one character
                                         //ex: ab&amp;cd ---&gt; acd
      {
         if ( del == string.charAt(i) )
         {
            if (stack.size() &gt; 0)
               stack.remove(stack.size()-1);
         }
         else if( destroy == string.charAt(i) )
        {
         stack.remove(stack.size());
  
        }
      }
  }
  }
  </code></pre>