List of utility methods to do String Ends With
boolean | endsWith(byte[] bytes, String str) ends With if (bytes.length < str.length()) return false; int actualByteCount = bytes.length; while ((actualByteCount > 0) && ((bytes[actualByteCount - 1] == '\n') || (bytes[actualByteCount - 1] == '\r'))) actualByteCount--; if (actualByteCount < str.length()) return false; ... |
boolean | endsWith(byte[] dataFrom, String suffix) ends With for (int i = 1; i <= suffix.length(); i++) { int dfOffset = dataFrom.length - i; int suffixOffset = suffix.length() - i; if (dataFrom[dfOffset] != suffix.charAt(suffixOffset)) { return false; return true; ... |
boolean | endsWith(byte[] source, char c) ends With return endsWith(source, new byte[] { (byte) c }); |
boolean | endsWith(byte[] subject, byte[] suffix) Returns true if subject ends with suffix . int start = subject.length - suffix.length; if (start < 0) { return false; for (int i = start; i < subject.length; i++) { if (subject[i] != suffix[i - start]) { return false; return true; |
boolean | endsWith(char s[], int len, char suffix[]) Returns true if the character array ends with the suffix. final int suffixLen = suffix.length; if (suffixLen > len) return false; for (int i = suffixLen - 1; i >= 0; i--) if (s[len - (suffixLen - i)] != suffix[i]) return false; return true; |
boolean | endsWith(char[] fieldDescriptor, char c) ends With if (fieldDescriptor.length == 0) { return false; return fieldDescriptor[fieldDescriptor.length - 1] == c; |
boolean | endsWith(CharSequence cs, CharSequence suffix) Tests if a char sequence ends with some suffix return startsWith(cs, suffix, (cs.length() - suffix.length()));
|
boolean | endsWith(CharSequence cs, String postfix) Returns whether cs ends with postfix .
boolean match; int sbLen = cs.length(); int pLen = postfix.length(); if (sbLen >= pLen) { match = true; for (int p = pLen - 1, s = sbLen - 1; match && p >= 0; p--, s--) { match = postfix.charAt(p) == cs.charAt(s); } else { match = false; return match; |
boolean | endsWith(CharSequence s, char c) Determine if the string s ends with the char c . int len = s.length(); return len > 0 && s.charAt(len - 1) == c; |
boolean | endsWith(CharSequence s, char c) ends With if (s == null) return false; int len = s.length(); if (len == 0) return false; return s.charAt(len - 1) == c; |