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)
| 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. |