Java String Starts Wtih startsWithChar(String s, char c)

Here you can find the source of startsWithChar(String s, char c)

Description

starts With Char

License

Open Source License

Declaration

public static boolean startsWithChar(String s, char c) 

Method Source Code

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

public class Main {

    public static boolean startsWithChar(String s, char c) {
        if (s.length() == 0) {
            return false;
        }/*w  ww  .  j av  a 2s .c  om*/
        return s.charAt(0) == c;
    }

    /**
     * Gets a String's length or <code>0</code> if the String is
     * <code>null</code>.
     *
     * @param str
     *            a String or <code>null</code>
     * @return String length or <code>0</code> if the String is
     *         <code>null</code>.
     * @since 2.4
     */
    public static int length(String str) {
        return str == null ? 0 : str.length();
    }
}

Related

  1. startsWithAt(String text, String toFind, int offset)
  2. startsWithCamelCase(String string, String prefix)
  3. startsWithCapLettersEndsWithDigits(String text)
  4. startsWithChar(CharSequence s, char prefix)
  5. startsWithChar(final String s, final char c)
  6. startsWithChar(String string, char prefix)
  7. startsWithChar(String string, int character)
  8. startsWithCharacter(String str, char stringStart)
  9. startsWithCharacter(String str, String matchChars)