public static String removeEnd(final String str, final String removeStr) {
        if (N.isNullOrEmpty(str) || N.isNullOrEmpty(removeStr)) {
            return str;
        }

        if (str.endsWith(removeStr)) {
            return str.substring(0, str.length() - removeStr.length());
        }

        return str;
    }
public static String removeEnd ( final String str , final String removeStr ) { if ( N . isNullOrEmpty ( str ) || N . isNullOrEmpty ( removeStr ) ) { return str ; } if ( str . endsWith ( removeStr ) ) { return str . substring ( 0 , str . length ( ) - removeStr . length ( ) ) ; } return str ; }
<p>
Removes a substring only if it is at the end of a source string,
otherwise returns the source string.
</p>

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

<pre>
N.removeEnd(null, *)      = null
N.removeEnd("", *)        = ""
N.removeEnd(*, null)      = *
N.removeEnd("www.domain.com", ".com.")  = "www.domain.com"
N.removeEnd("www.domain.com", ".com")   = "www.domain"
N.removeEnd("www.domain.com", "domain") = "www.domain.com"
N.removeEnd("abc", "")    = "abc"
</pre>

@param str
the source String to search, may be null
@param removeStr
the String to search for and remove, may be null
@return the substring with the string removed if found, {@code null} if
null String input
@since 2.1