public static String substringBefore(final String s, final String separator) {
        if (isEmpty(s) || separator == null) {
            return s;
        }
        if (separator.isEmpty()) {
            return "";
        }
        final int pos = s.indexOf(separator);
        if (pos < 0) {
            return s;
        }
        return s.substring(0, pos);
    }
public static String substringBefore(final String s, final String separator) {
        if (isEmpty(s) || separator == null) {
            return s;
        }
        if (separator.isEmpty()) {
            return "";
        }
        final int pos = s.indexOf(separator);
        if (pos < 0) {
            return s;
        }
        return s.substring(0, pos);
    }
public static String substringBefore ( final String s , final String separator ) { if ( isEmpty ( s ) || separator == null ) { return s ; } if ( separator . isEmpty ( ) ) { return "" ; } final int pos = s . indexOf ( separator ) ; if ( pos < 0 ) { return s ; } return s . substring ( 0 , pos ) ; }
<p>
Gets the substring before the first 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. A {@code null} separator will
return the input string.
</p>

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

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