List of utility methods to do String Ends With
boolean | EndsWith(String x, String z) Ends With return x.endsWith(z);
|
boolean | endsWith(String[] endsWith, String line) return true if line ends with something in the array for (String s : endsWith) { if (line.endsWith(s)) { return true; return false; |
boolean | endsWith(String[] searchStrings, String text) Returns whether the text ends with one of the given search strings. for (int i = 0; i < searchStrings.length; i++) { if (text.endsWith(searchStrings[i])) return true; return false; |
int | endsWith(String[] searchStrings, String text) Returns the index of the longest search string with which the given text ends or -1 if none matches.
int index = -1; for (int i = 0; i < searchStrings.length; i++) { if (text.endsWith(searchStrings[i])) { if (index == -1 || searchStrings[i].length() > searchStrings[index].length()) index = i; return index; ... |
boolean | endsWith(StringBuffer buf, String s) ends With int iBuf = buf.length(); int iS = s.length(); while (--iS >= 0 && --iBuf >= 0 && buf.charAt(iBuf) == s.charAt(iS)) { return iS < 0; |
boolean | endsWith(StringBuffer buffer, String suffix) Checks that a string buffer ends up with a given string. if (suffix.length() > buffer.length()) { return false; int endIndex = suffix.length() - 1; int bufferIndex = buffer.length() - 1; while (endIndex >= 0) { if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) { return false; ... |
boolean | endsWith(StringBuffer in, String ending) Returns true if the StringBuffer parameter ends with the ending String. return (in.length() >= ending.length() && (in.substring(in.length() - ending.length()).equals(ending)));
|
boolean | endsWith(StringBuilder sb, String end) ends With int i = sb.indexOf(end, sb.length() - end.length()); return i != -1; |
boolean | endsWith(StringBuilder sb, String s) ends With int len = s.length(); if (sb.length() < len) { return false; for (int i = sb.length() - len, j = 0; j < len; i++, j++) { if (sb.charAt(i) != s.charAt(j)) { return false; return true; |
boolean | endsWith(StringBuilder sb, String suffix) Tests if this StringBuilder ends with the specified suffix. return startsWith(sb, suffix, sb.length() - suffix.length());
|