jetbrick-commons/src/main/java/jetbrick/lang/StringUtils.java
public static String substringBeforeLast(final String s, final String separator) {
        if (isEmpty(s) || isEmpty(separator)) {
            return s;
        }
        final int pos = s.lastIndexOf(separator);
        if (pos < 0) {
            return s;
        }
        return s.substring(0, pos);
    }
public static String substringBeforeLast(final String s, final String separator) {
        if (isEmpty(s) || isEmpty(separator)) {
            return s;
        }
        final int pos = s.lastIndexOf(separator);
        if (pos < 0) {
            return s;
        }
        return s.substring(0, pos);
    }
public static String substringBeforeLast ( final String s , final String separator ) { if ( isEmpty ( s ) || isEmpty ( separator ) ) { return s ; } final int pos = s . lastIndexOf ( separator ) ; if ( pos < 0 ) { return s ; } return s . substring ( 0 , pos ) ; }
<p>
Gets the substring before the last occurrence of a separator. The
separator is not returned.
</p>

<p>
A {@code null} string input will return {@code null}. An empty ("")
string input will return the empty string. An empty or {@code null}
separator will return the input string.
</p>

<p>
If nothing is found, the string input is returned.
</p>

<pre>
StringUtils.substringBeforeLast(null, *)      = null
StringUtils.substringBeforeLast("", *)        = ""
StringUtils.substringBeforeLast("abcba", "b") = "abc"
StringUtils.substringBeforeLast("abc", "c")   = "ab"
StringUtils.substringBeforeLast("a", "a")     = ""
StringUtils.substringBeforeLast("a", "z")     = "a"
StringUtils.substringBeforeLast("a", null)    = "a"
StringUtils.substringBeforeLast("a", "")      = "a"
</pre>
<p > Gets the substring before the last occurrence of a separator . The separator is not returned . < / p >