public static String substringBefore ( final String str , final String separator ) { if ( Strings . isNullOrEmpty ( str ) ) { return str ; } final int pos = str . indexOf ( separator ) ; if ( pos == - 1 ) { return str ; } return str . substring ( 0 , pos ) ; }
Returns substring before provided string