Java String Starts Wtih startsWithIgnoreCase(String s, String start)

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

Description

Check is a string starts with another string, ignoring the case.

License

Open Source License

Parameter

Parameter Description
s the string to check (must be longer than start)
start the prefix of s

Return

true if start is a prefix of s

Declaration

public static boolean startsWithIgnoreCase(String s, String start) 

Method Source Code

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

public class Main {
    /**//from ww w.  j  a v  a  2  s.co  m
     * Check is a string starts with another string, ignoring the case.
     *
     * @param s the string to check (must be longer than start)
     * @param start the prefix of s
     * @return true if start is a prefix of s
     */
    public static boolean startsWithIgnoreCase(String s, String start) {
        if (s.length() < start.length()) {
            return false;
        }
        return s.substring(0, start.length()).equalsIgnoreCase(start);
    }
}

Related

  1. startsWithIgnoreCase(String p_sStr, String p_sSubStr)
  2. startsWithIgnoreCase(String s, int offset, int end, String lowerCase)
  3. startsWithIgnoreCase(String s, String prefix)
  4. startsWithIgnoreCase(String s, String prefix)
  5. startsWithIgnoreCase(String s, String prefix)
  6. startsWithIgnoreCase(String s, String w)
  7. startsWithIgnoreCase(String searchIn, int startAt, String searchFor)
  8. startsWithIgnoreCase(String searchIn, int startAt, String searchFor)
  9. startsWithIgnoreCase(String searchIn, String searchFor)