Java String Starts Wtih startsWith(String str, String start, boolean caseSensitive)

Here you can find the source of startsWith(String str, String start, boolean caseSensitive)

Description

starts With

License

Open Source License

Declaration

public static boolean startsWith(String str, String start, boolean caseSensitive) 

Method Source Code

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

public class Main {
    public static boolean startsWith(String str, String start, boolean caseSensitive) {
        if (str == null || start == null) {
            return (str == null && start == null);
        }//  w w  w . ja va2 s. com
        if (start.length() > str.length()) {
            return false;
        }

        return str.regionMatches(caseSensitive, 0, start, 0, start.length());
    }
}

Related

  1. startsWith(String str, String prefix)
  2. StartsWith(String str, String prefix)
  3. startsWith(String str, String prefix, boolean ignoreCase)
  4. startsWith(String str, String prefix, boolean ignoreCase)
  5. startsWith(String str, String prefix, int index)
  6. startsWith(String str1Raw, String str2Raw)
  7. startsWith(String string, char... ca)
  8. startsWith(String string, String prefix)
  9. startsWith(String string, StringBuffer prefix, int toffset)