Mega Code Archive

 
Categories / Java / Data Type
 

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

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