List of utility methods to do String Ends With
boolean | endsWithIC(String a, String b) ends With IC if (a == null || b == null) return false; else if (a.endsWith(b)) return true; else return a.toLowerCase().endsWith(b.toLowerCase()); |
boolean | endsWithIC(String s1, String s2) Returns whether s1 ends with s2, ignoring case. return s1 != null && s2 != null && s1.regionMatches(true, s1.length() - s2.length(), s2, 0, s2.length());
|
boolean | endsWithIgnoreCase(final String base, final String end) ends With Ignore Case if (base.length() < end.length()) { return false; return base.regionMatches(true, base.length() - end.length(), end, 0, end.length()); |
boolean | endsWithIgnoreCase(final String base, final String end) Helper functions to query a strings end portion. if (base.length() < end.length()) { return false; return base.regionMatches(true, base.length() - end.length(), end, 0, end.length()); |
boolean | endsWithIgnoreCase(final String haystack, final String needle) Does a string end with a second string ignoring case? return needle.equalsIgnoreCase(haystack.substring(haystack.length() - needle.length(), haystack.length()));
|
boolean | endsWithIgnoreCase(final String haystack, final String needle) ends With Ignore Case if (haystack == null) throw new IllegalArgumentException("Parameter 'haystack' is null."); if (needle == null) throw new IllegalArgumentException("Parameter 'needle' is null."); final int nl = needle.length(); final int hl = haystack.length(); if (nl == hl) { return haystack.equalsIgnoreCase(needle); ... |
boolean | endsWithIgnoreCase(final String input, final String suffix) Checks if a string ends with a given suffix. if (input == null) throw new IllegalArgumentException("Input cannot be null!"); if (suffix == null) throw new IllegalArgumentException("Suffix cannot be null!"); return input.endsWith(suffix) || input.length() >= suffix.length() && input.toLowerCase().endsWith(suffix.toLowerCase()); |
boolean | endsWithIgnoreCase(final String source, final String target) Returns true if given source string end with target string ignore case sensitive; false otherwise. if (source.endsWith(target)) { return true; if (source.length() < target.length()) { return false; return source.substring(source.length() - target.length()).equalsIgnoreCase(target); |
boolean | endsWithIgnoreCase(final String str, final String end) Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) implementation is not creating extra strings. if (str == null && end == null) { return true; if (str == null) { return false; if (end == null) { return false; ... |
boolean | endsWithIgnoreCase(final String string, final String end) ends With Ignore Case assert string != null; assert end != null; if (string.length() < end.length()) return false; return string.substring(string.length() - end.length()).equalsIgnoreCase(end); |