Mega Code Archive

 
Categories / Java / Data Type
 

Helper functions to query a strings end portion The comparison is case insensitive

public class Main {   /**    * Helper functions to query a strings end portion. The comparison is case insensitive.    *    * @param base  the base string.    * @param end  the ending text.    *    * @return true, if the string ends with the given ending text.    */   public static boolean endsWithIgnoreCase(final String base, final String end) {       if (base.length() < end.length()) {           return false;       }       return base.regionMatches(true, base.length() - end.length(), end, 0, end.length());   } }