Java String Starts Wtih startsWithIgnoreCase(final String base, final String start)

Here you can find the source of startsWithIgnoreCase(final String base, final String start)

Description

Helper functions to query a strings start portion.

License

LGPL

Parameter

Parameter Description
base the base string.
start the starting text.

Return

true, if the string starts with the given starting text.

Declaration

public static boolean startsWithIgnoreCase(final String base, final String start) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*ww w . j  a  va 2  s  .c om*/
     * 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());
    }

    public static int length(String str) {
        if (str == null)
            return 0;
        return str.length();
    }
}

Related

  1. startsWithConcatenationOf(String testee, String firstPrefix, String secondPrefix)
  2. startsWithCS(String a, String b)
  3. startsWithDigitsFollowedByLetters(String str)
  4. startsWithHtml(Object object)
  5. startsWithIC(String s1, String... strings)
  6. startsWithIgnoreCase(final String haystack, final String needle)
  7. startsWithIgnoreCase(final String iFirst, final String iSecond)
  8. startsWithIgnoreCase(final String input, final String prefix)
  9. startsWithIgnoreCase(final String source, final String target)