Java Utililty Methods String Ends With

List of utility methods to do String Ends With

Description

The list of methods to do String Ends With are organized into topic(s).

Method

booleanendsWithIgnoreCase(final String text, final String suffix)
Tests if the string ends with the specified suffix.
if (isEmpty(text)) {
    return false;
if (suffix == null) {
    return false;
int textLength = text.length();
int suffixLength = suffix.length();
...
booleanendsWithIgnoreCase(final String text, final String suffix)
Tests if the string ends with the specified suffix.
if (isEmpty(text)) {
    return false;
if (suffix == null) {
    return false;
int textLength = text.length();
int suffixLength = suffix.length();
...
booleanendsWithIgnoreCase(final String text, final String suffix)
Tests if the string ends with the specified suffix.
if (text == null || suffix == null) {
    return false;
return text.regionMatches(true, text.length() - suffix.length(), suffix, 0, suffix.length());
booleanendsWithIgnoreCase(Object string, Object suffix)
ends With Ignore Case
return endsWith(string, suffix, length(string), true);
booleanendsWithIgnoreCase(String a, String b)
Returns true if a ends with b regardless of the case.
return matchesIgnoreCase(a, b, a.length());
booleanendsWithIgnoreCase(String baseString, String compareString)
endsWithIgnoreCase
if (baseString == null)
    return false;
else
    return baseString.toUpperCase().endsWith(compareString.toUpperCase());
booleanendsWithIgnoreCase(String haystack, String needle)
Checks to see if a string ends with another string in a case-insensitive manner.
if (needle.length() > haystack.length()) {
    return false;
for (int i = 0; i < needle.length(); i++) {
    int start = haystack.length() - needle.length() + i;
    if (!haystack.substring(start, start + 1).equalsIgnoreCase(needle.substring(i, i + 1))) {
        return false;
return true;
booleanendsWithIgnoreCase(String input, String suffix)
ends With Ignore Case
if (input.length() < suffix.length())
    return false;
String inputSuf = input.substring(input.length() - suffix.length());
return inputSuf.equalsIgnoreCase(suffix);
booleanendsWithIgnoreCase(String input, String... suffixes)
Tests if this string ends with any of the given suffixes, ignoring the case sensitive.
boolean found = true;
String lowerInput = input.toLowerCase();
if (suffixes != null && suffixes.length > 0) {
    for (String suffix : suffixes) {
        found = lowerInput.endsWith(suffix.toLowerCase());
        if (found)
            break;
return found;
booleanendsWithIgnoreCase(String name, Iterable patterns)
Does the given column name ends with one of pattern given in parameter.
String nameUpper = name.toUpperCase();
for (String pattern : patterns) {
    String patternUpper = pattern.toUpperCase();
    if (nameUpper.equals(patternUpper) || nameUpper.endsWith(patternUpper)) {
        return true;
return false;
...