Here you can find the source of endsWithIgnoreCase(final String text, final String suffix)
Parameter | Description |
---|---|
text | the string to test. |
suffix | the suffix. |
true
if the character sequence represented by the argument is a suffix of the character sequence represented by this object; false
otherwise. Note that the result will be true
if the suffix is the empty string or is equal to this String
object as determined by the method. If the text or suffix argument is null false
is returned.
public static boolean endsWithIgnoreCase(final String text, final String suffix)
//package com.java2s; //License from project: Apache License public class Main { /**/* w ww.j a v a2s . com*/ * Tests if the string ends with the specified suffix. * * @param text the string to test. * @param suffix the suffix. * @return <code>true</code> if the character sequence represented by the * argument is a suffix of the character sequence represented by * this object; <code>false</code> otherwise. Note that the * result will be <code>true</code> if the suffix is the * empty string or is equal to this <code>String</code> object * as determined by the {@link #equals(Object)} method. If the text or * suffix argument is null <code>false</code> is returned. */ public static boolean endsWithIgnoreCase(final String text, final String suffix) { if (text == null || suffix == null) { return false; } return text.regionMatches(true, text.length() - suffix.length(), suffix, 0, suffix.length()); } }