Java String Starts Wtih startsWith(String string, char... ca)

Here you can find the source of startsWith(String string, char... ca)

Description

starts With

License

LGPL

Declaration

public static final boolean startsWith(String string, char... ca) 

Method Source Code

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

public class Main {
    public static final boolean startsWith(String string, char... ca) {
        int l = ca.length;
        for (int i = 0; i < l; i++) {
            if (string.charAt(i) != ca[i])
                return false;
        }// w  w w  . j  a  v a  2  s  .c  o  m
        return true;
    }

    public static final boolean startsWith(String string, char ca, char cb) {
        if (string.charAt(0) != ca)
            return false;
        if (string.charAt(1) != cb)
            return false;
        return true;
    }

    public static final boolean startsWith(String string, char ca, char cb, char cc) {
        if (string.charAt(0) != ca)
            return false;
        if (string.charAt(1) != cb)
            return false;
        if (string.charAt(1) != cc)
            return false;
        return true;
    }
}

Related

  1. startsWith(String str, String prefix, boolean ignoreCase)
  2. startsWith(String str, String prefix, boolean ignoreCase)
  3. startsWith(String str, String prefix, int index)
  4. startsWith(String str, String start, boolean caseSensitive)
  5. startsWith(String str1Raw, String str2Raw)
  6. startsWith(String string, String prefix)
  7. startsWith(String string, StringBuffer prefix, int toffset)
  8. startsWith(String target, String... prefixes)
  9. startsWith(String text, String prefix, int toffset)