Java String Starts Wtih startsWith(String cid1, String cid2)

Here you can find the source of startsWith(String cid1, String cid2)

Description

Check if cid1 starts with cid2.

License

Open Source License

Parameter

Parameter Description
cid1 a parameter
cid2 a parameter

Declaration

public static boolean startsWith(String cid1, String cid2) 

Method Source Code

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

public class Main {
    /**//  w  w  w.j  a  v a  2 s. c  om
     * Check if cid1 starts with cid2.
     * 
     * @param cid1
     * @param cid2
     * @return
     */
    public static boolean startsWith(String cid1, String cid2) {
        if (cid1 == null && cid2 == null) {
            return true;
        }
        if (cid1 == null || cid2 == null) {
            return false;
        }
        if (cid1.startsWith(cid2) && cid1.charAt(cid2.length()) == '.') {
            return true;
        }
        return false;
    }
}

Related

  1. startsWith(final String src, final String sub)
  2. startsWith(final String str, final char prefix)
  3. startsWith(final String str, final String... prefixes)
  4. startsWith(String baseString, String compareString)
  5. startsWith(String check, String doesStartWith)
  6. startsWith(String comparee, char comparant)
  7. startsWith(String inStart, String inValue)
  8. startsWith(String n, char tag)
  9. startsWith(String partial, String possible)