Java Utililty Methods String Ends With

List of utility methods to do String Ends With

Description

The list of methods to do String Ends With are organized into topic(s).

Method

booleanendsWithChar(String s, char c)
ends With Char
if (s.length() == 0) {
    return false;
return s.charAt(s.length() - 1) == c;
booleanendsWithChar(String string, char suffix)
Tests if this string ends with the specified suffix.
return string.length() > 0 && string.charAt(string.length() - 1) == suffix;
booleanendsWithChar(String string, int character)
Return true if the given string ends with the given character.
int length = string.length();
return length > 0 && string.charAt(length - 1) == character;
booleanendsWithContinuationMarker(String line)
ends With Continuation Marker
boolean evenSlashCount = true;
int index = line.length() - 1;
while (index >= 0 && line.charAt(index) == '\\') {
    evenSlashCount = !evenSlashCount;
    index--;
return !evenSlashCount;
booleanendsWithCVC(String str)
ends With CVC
char c;
char v;
char c2;
if (str.length() >= 3) {
    c = str.charAt(str.length() - 1);
    v = str.charAt(str.length() - 2);
    c2 = str.charAt(str.length() - 3);
} else {
...
booleanendsWithDigit(final String s)
ends With Digit
if (!isEmpty(s)) {
    return Character.isDigit(s.charAt(s.length() - 1));
return false;
booleanendsWithDoubleConsonent(String str)
ends With Double Consonent
char c = str.charAt(str.length() - 1);
if (str.length() > 1 && c == str.charAt(str.length() - 2)) {
    if (!containsVowel(str.substring(str.length() - 2))) {
        return true;
return false;
booleanendsWithExtension(final String fileName, final String extension)
ends With Extension
return fileName != null && fileName.toLowerCase().endsWith(extension.toLowerCase());
booleanendsWithFFD9(byte[] data)
ends With FFD
return (data[data.length - 2] & 0xFF) == 255 && (data[data.length - 1] & 0xFF) == 217;
booleanendsWithGaps(final byte[] aFrag, final int numEndGaps)
ends With Gaps
for (int i = 1; i <= numEndGaps; i++) {
    if (i <= 0) {
        return true;
    if (!isGap(aFrag[aFrag.length - i])) {
        return false;
return true;