title: remove the last part of a string in java
body: <pre><code>String Y="part1 part2 part3",X="part1";
  
  boolean foundMatch = false;
  while(!foundMatch) {
      foundMatch = Y.equals(X);
      if(foundMatch) {
          break;
      }
      else {
          Y = useSplitToRemoveLastPart(Y);
          if(Y.equals("")) {
              break;
          }
      }
  </code></pre>
  
  <p>//implementation of useSplitToRemoveLastPart()</p>
  
  <pre><code>private static String useSplitToRemoveLastPart(String y) {
  
    //What goes here .. It should chop the last part of the string..
  return null;
  
   }
  </code></pre>
  
  <p>Can anyone help ...</p>