Java String Starts Wtih startsWithIgnoreCase(String startString, String anotherString)

Here you can find the source of startsWithIgnoreCase(String startString, String anotherString)

Description

check whether a string starts with anotherString (ignore case)

License

Open Source License

Parameter

Parameter Description
startString a parameter
anotherString a parameter

Declaration

public static boolean startsWithIgnoreCase(String startString, String anotherString) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  ww  w . ja v  a 2  s  . com
     * check whether a string starts with anotherString (ignore case)
     *
     * @param startString
     * @param anotherString
     * @return
     */
    public static boolean startsWithIgnoreCase(String startString, String anotherString) {
        int length = startString.length();
        if (length > anotherString.length()) {
            return false;
        }
        if (startString.equalsIgnoreCase(anotherString.substring(0, length))) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. startsWithIgnoreCase(String s, String w)
  2. startsWithIgnoreCase(String searchIn, int startAt, String searchFor)
  3. startsWithIgnoreCase(String searchIn, int startAt, String searchFor)
  4. startsWithIgnoreCase(String searchIn, String searchFor)
  5. startsWithIgnoreCase(String seq, String prefix)
  6. startsWithIgnoreCase(String str, String prefix)
  7. startsWithIgnoreCase(String str, String prefix)
  8. startsWithIgnoreCase(String str, String prefix)
  9. startsWithIgnoreCase(String str, String prefix)