Java String Starts Wtih startsWith(String s, String begin)

Here you can find the source of startsWith(String s, String begin)

Description

starts With

License

Apache License

Declaration

public static boolean startsWith(String s, String begin) 

Method Source Code

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

public class Main {
    public static boolean startsWith(String s, String begin) {
        if ((s == null) || (begin == null)) {
            return false;
        }/*w w w .ja  va  2  s  .com*/

        if (begin.length() > s.length()) {
            return false;
        }

        String temp = s.substring(0, begin.length());

        if (temp.equalsIgnoreCase(begin)) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. startsWith(String receiver, String... needles)
  2. startsWith(String s, boolean caseIgnore, String... args)
  3. startsWith(String s, char begin)
  4. startsWith(String s, char c)
  5. startsWith(String s, int offset, int end, String t)
  6. startswith(String s, String prefix)
  7. startsWith(String s, String prefix)
  8. startsWith(String s, String prefix)
  9. startsWith(String s, String start)