List of utility methods to do String Ends With
boolean | endsWithIgnoreCase(String str, String suffix) Checks if the given String ends with the given suffix, ignoring case. if (str == null) throw new IllegalArgumentException("Parameter 'str' cannot be null!"); if (suffix == null) throw new IllegalArgumentException("Parameter 'suffix' cannot be null!"); if (str.length() < suffix.length()) return false; String ending = str.substring(str.length() - suffix.length()); return ending.equalsIgnoreCase(suffix); ... |
boolean | endsWithIgnoreCase(String str, String suffix) ends With Ignore Case if (str == null || suffix == null) { return false; if (str.endsWith(suffix)) { return true; if (str.length() < suffix.length()) { return false; ... |
boolean | endsWithIgnoreCase(String str, String suffix) This method is equivalent to String#endsWith(String) with the exception that String#equalsIgnoreCase(String) is used, instead of String#equals(Object) . if (str == null || suffix == null) { return false; int strLength = str.length(); int suffixLength = suffix.length(); if (suffixLength == 0) { return true; if (strLength < suffixLength) { return false; String strSuffix = str.substring(strLength - suffixLength); return strSuffix.equalsIgnoreCase(suffix); |
boolean | endsWithIgnoreCase(String string, String suffix) Tests if the string ends with the suffix, ignoring case considerations if (string == null || suffix == null) { return false; int length = suffix.length(); int toffset = string.length() - length; if (toffset < 0) { return false; return string.regionMatches(true, toffset, suffix, 0, length); |
boolean | endsWithIgnoreCase(String target1, String target2) ends With Ignore Case if (target1 == null || target2 == null) { return false; int length1 = target1.length(); int length2 = target2.length(); if (length1 < length2) { return false; String s1 = target1.substring(length1 - length2); return s1.equalsIgnoreCase(target2); |
boolean | endsWithIgnoreCase(String text, String suffix) ends With Ignore Case if (text == null) return (suffix == null); if (suffix == null) return false; return text.toLowerCase().endsWith(suffix.toLowerCase()); |
boolean | endsWithIgnoreCase(String toCheck, String suffix) Returns true if the string to check ends with the specified suffix; this check is case-insensitive. boolean endsWith; if (toCheck == suffix) { endsWith = true; } else if (toCheck == null || suffix == null) { endsWith = false; } else { toCheck = toCheck.toLowerCase(); suffix = suffix.toLowerCase(); ... |
boolean | endsWithIgnSpace(String s, String ending) See if the given string ends with the given ending, IGNORING ALL SPACES IN THE INPUT STRING. int si = s.length() - 1; for (int ei = ending.length() - 1; ei >= 0; ei--, si--) { while (si >= 0 && Character.isWhitespace(s.charAt(si))) { si--; if (si < 0) { return false; char a = Character.toLowerCase(s.charAt(si)); char b = Character.toLowerCase(ending.charAt(ei)); if (a != b) { if ((a == '=') || (a == '-') && (b == '=' || (b == '-'))) { continue; return false; return true; |
boolean | endsWithIllegalWindowsChar(String filename) windows filename may not end with . return filename.endsWith(".") || filename.endsWith(" "); |
int | endsWithIndex(String[] suffixes, String propertyName) ends With Index if (suffixes != null && propertyName != null) { int i = 0; for (String string : suffixes) { if (propertyName.endsWith(string)) { return i; i++; return -1; |