List of utility methods to do String Ends With
boolean | endsWith(CharSequence s, CharSequence seq) Behaves like String.endsWith but for CharSequence .
return regionMatches(false, s, s.length() - seq.length(), seq, 0, seq.length());
|
boolean | endsWith(CharSequence s, CharSequence sub) Evaluates if the first CharSequence ends with the second. if (null == s) { return null == sub; } else if (null == sub) { return false; int l1 = s.length(); int l2 = sub.length(); return l1 >= l2 && s.subSequence(l1 - l2, l1).equals(sub.toString()); ... |
boolean | endsWith(CharSequence seq, char... any) ends With for (int i = 0; i < any.length; i++) { if (seq.charAt(seq.length() - 1) == any[i]) return true; return false; |
boolean | endsWith(CharSequence source, CharSequence search) Returns true if the source sequence ends with the search sequence. if (source == null) return false; if (search == null) return false; int loc = source.length() - search.length(); return containsAt(source, search, loc); |
boolean | endsWith(CharSequence str, char suffix) ends With if (str == null) { return false; if (str.length() < 1) { return false; char lastCh = str.charAt(str.length() - 1); return (lastCh == suffix); ... |
boolean | endsWith(CharSequence str, CharSequence suffix) Return true if one CharSequence ends with the other. if (str == null || suffix == null) return false; if (str instanceof String && suffix instanceof String) return ((String) str).endsWith((String) suffix); if (str.length() < suffix.length()) return false; int j = str.length(); for (int i = suffix.length(); i-- > 0;) ... |
boolean | endsWith(final boolean caseSensitive, final String text, final String suffix) Checks whether a text ends with a specified suffix. if (text == null) { throw new IllegalArgumentException("Text cannot be null"); if (suffix == null) { throw new IllegalArgumentException("Suffix cannot be null"); return (caseSensitive ? text.endsWith(suffix) : endsWith(caseSensitive, text, 0, text.length(), suffix, 0, suffix.length())); ... |
boolean | endsWith(final byte[] big, final byte[] suffix) Does big end with the exact sequence of bytes in suffix? if (big == null) throw new IllegalArgumentException("big cannot be null"); if (suffix == null) throw new IllegalArgumentException("suffix cannot be null"); return new String(big).endsWith(new String(suffix)); |
boolean | endsWith(final byte[] str1, int startIndex1, int endIndex1, final byte[] str2, int startIndex2, int endIndex2) ends With if (startIndex1 < 0) { startIndex1 = 0; if (endIndex1 > str1.length) { endIndex1 = str1.length; if (startIndex2 < 0) { startIndex2 = 0; ... |
boolean | endsWith(final CharSequence a, final CharSequence b) ends With final int len = b.length(); final int off = len - a.length(); if (off < 0) { return false; for (int i = 0; i < len; i++) { if (a.charAt(off + i) != b.charAt(i)) { return false; ... |