MCPcopy Create free account
hub / github.com/apache/commons-lang / endsWith

Method endsWith

src/main/java/org/apache/commons/lang3/Strings.java:622–631  ·  view source on GitHub ↗

Tests if a CharSequence ends with a specified suffix. Case-sensitive examples Strings.CS.endsWith(null, null) = true Strings.CS.endsWith(null, "def") = false Strings.CS.endsWith("abcdef", null) = false Strings.CS.endsWith("abcdef", "def") = true Strings.CS.endsWith("ABCDEF

(final CharSequence str, final CharSequence suffix)

Source from the content-addressed store, hash-verified

620 * @see String#endsWith(String)
621 */
622 public boolean endsWith(final CharSequence str, final CharSequence suffix) {
623 if (str == null || suffix == null) {
624 return str == suffix;
625 }
626 final int sufLen = suffix.length();
627 if (sufLen > str.length()) {
628 return false;
629 }
630 return CharSequenceUtils.regionMatches(str, ignoreCase, str.length() - sufLen, suffix, 0, sufLen);
631 }
632
633 /**
634 * Tests if a CharSequence ends with any of the provided suffixes.

Callers 9

appendIfMissingMethod · 0.95
endsWithAnyMethod · 0.95
removeEndMethod · 0.95
testLang708Method · 0.45
testToStringMethod · 0.45
getCanonicalNameMethod · 0.45
toCleanNameMethod · 0.45

Calls 2

regionMatchesMethod · 0.95
lengthMethod · 0.45