src/main/java/com/ve/cxe/commons/util/StringUtils.java
/**
     * <p>Gets the substring before the first occurrence of a separator.
     * The separator is not returned.</p>
     * <p>
     * <p>A <code>null</code> string input will return <code>null</code>.
     * An empty ("") string input will return the empty string.
     * A <code>null</code> separator will return the input string.</p>
     * <p>
     * <p>If nothing is found, the string input is returned.</p>
     * <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>
     *
     * @param str       the String to get a substring from, may be null
     * @param separator the String to search for, may be null
     * @return the substring before the first occurrence of the separator,
     * <code>null</code> if null String input
     */
Gets the substring before the first occurrence of a separator.
The separator is not returned.

A null string input will return null.
An empty ("") string input will return the empty string.

@param str       the String to get a substring from, may be null
@param separator the String to search for, may be null
@return the substring before the first occurrence of the separator,
null if null String input
Gets the substring before the first occurrence of a separator . The separator is not returned . A null string input will return null . An empty ( " " ) string input will return the empty string . @param str the String to get a substring from may be null @param separator the String to search for may be null @return the substring before the first occurrence of the separator null if null String input
public static String substringBefore(String str, String separator) {
        if (isEmpty(str) || separator == null) {
            return str;
        }
        if (separator.length() == 0) {
            return EMPTY_STRING;
        }
        int pos = str.indexOf(separator);
        if (pos == INDEX_NOT_FOUND) {
            return str;
        }
        return str.substring(0, pos);
    }
public static String substringBefore ( String str , String separator ) { if ( isEmpty ( str ) || separator == null ) { return str ; } if ( separator . length ( ) == 0 ) { return EMPTY_STRING ; } int pos = str . indexOf ( separator ) ; if ( pos == INDEX_NOT_FOUND ) { return str ; } return str . substring ( 0 , pos ) ; }
<p>Gets the substring before the first occurrence of a separator.
<p > Gets the substring before the first occurrence of a separator .