code: public static String getPrechomp(String str, String sep) {
        int idx = str.indexOf(sep);
        if (idx == -1) {
            return EMPTY;
        }
        return str.substring(0, idx + sep.length());
    }
docs: <p>Remove and return everything before the first value of a
  supplied String from another String.</p>
  
  @param str  the String to chomp from, must not be null
  @param sep  the String to chomp, must not be null
  @return String prechomped
  @throws NullPointerException if str or sep is <code>null</code>
  @deprecated Use {@link #substringBefore(String,String)} instead
  (although this doesn't include the separator).
  Method will be removed in Commons Lang 3.0.