Java String Starts Wtih startsWithIgnoreCase(String str, String prefix)

Here you can find the source of startsWithIgnoreCase(String str, String prefix)

Description

starts With Ignore Case

License

Open Source License

Declaration

public static boolean startsWithIgnoreCase(String str, String prefix) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean startsWithIgnoreCase(String str, String prefix) {
        return startsWith(str, prefix, true);
    }//from   ww w . j a v a  2  s  .  c om

    /**
     * StartsWith
     */
    public static boolean startsWith(String str, String prefix) {
        return startsWith(str, prefix, false);
    }

    private static boolean startsWith(String str, String prefix, boolean ignoreCase) {
        if (str == null || prefix == null) {
            return (str == null && prefix == null);
        }
        if (prefix.length() > str.length()) {
            return false;
        }
        return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length());
    }
}

Related

  1. startsWithIgnoreCase(String str, String prefix)
  2. startsWithIgnoreCase(String str, String prefix)
  3. startsWithIgnoreCase(String str, String prefix)
  4. startsWithIgnoreCase(String str, String prefix)
  5. startsWithIgnoreCase(String str, String prefix)
  6. startsWithIgnoreCase(String str, String start)
  7. startsWithIgnoreCase(String str1, String str2)
  8. startsWithIgnoreCase(String string1, String string2)
  9. startsWithIgnoreCase(String text, String prefix)