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

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

Description

Starts With

License

Creative Commons License

Declaration

public static boolean StartsWith(String str, String prefix) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean StartsWith(String str, String prefix) {
        if (str == null) {
            throw new NullPointerException("str");
        }/*from  w  w  w  . j a  va 2s  .  c om*/
        if (prefix == null) {
            throw new NullPointerException("prefix");
        }
        return (prefix.length() >= str.length()) && str.substring(0, prefix.length()).equals(prefix);
    }
}

Related

  1. startsWith(String str, char prefix)
  2. startsWith(String str, String mark, int paramInt)
  3. startsWith(String str, String prefix)
  4. startsWith(String str, String prefix)
  5. startsWith(String str, String prefix)
  6. startsWith(String str, String prefix, boolean ignoreCase)
  7. startsWith(String str, String prefix, boolean ignoreCase)
  8. startsWith(String str, String prefix, int index)
  9. startsWith(String str, String start, boolean caseSensitive)