jetbrick-commons/src/main/java/jetbrick/lang/StringUtils.java
public static String removeEndIgnoreCase(final String s, final String remove) {
        if (isEmpty(s) || isEmpty(remove)) {
            return s;
        }
        if (endsWithIgnoreCase(s, remove)) {
            return s.substring(0, s.length() - remove.length());
        }
        return s;
    }
public static String removeEndIgnoreCase(final String s, final String remove) {
        if (isEmpty(s) || isEmpty(remove)) {
            return s;
        }
        if (endsWithIgnoreCase(s, remove)) {
            return s.substring(0, s.length() - remove.length());
        }
        return s;
    }
public static String removeEndIgnoreCase ( final String s , final String remove ) { if ( isEmpty ( s ) || isEmpty ( remove ) ) { return s ; } if ( endsWithIgnoreCase ( s , remove ) ) { return s . substring ( 0 , s . length ( ) - remove . length ( ) ) ; } return s ; }
<p>
Case insensitive removal of a substring 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>
StringUtils.removeEndIgnoreCase(null, *)      = null
StringUtils.removeEndIgnoreCase("", *)        = ""
StringUtils.removeEndIgnoreCase(*, null)      = *
StringUtils.removeEndIgnoreCase("www.domain.com", ".com.")  = "www.domain.com"
StringUtils.removeEndIgnoreCase("www.domain.com", ".com")   = "www.domain"
StringUtils.removeEndIgnoreCase("www.domain.com", "domain") = "www.domain.com"
StringUtils.removeEndIgnoreCase("abc", "")    = "abc"
StringUtils.removeEndIgnoreCase("www.domain.com", ".COM") = "www.domain")
StringUtils.removeEndIgnoreCase("www.domain.COM", ".com") = "www.domain")
</pre>
<p > Case insensitive removal of a substring if it is at the end of a source string otherwise returns the source string . < / p >