Java String Starts Wtih startsWithUppercase(String str)

Here you can find the source of startsWithUppercase(String str)

Description

Returns true if the given string starts with an uppercase letter.

License

Open Source License

Parameter

Parameter Description
str string to check.

Return

true if the given string starts with an uppercase letter.

Declaration

public static boolean startsWithUppercase(String str) 

Method Source Code

//package com.java2s;
/*/*from w  ww .ja  va2  s. c o m*/
 * Copyright (c) 2001-2002, Marco Hunsicker. All rights reserved.
 *
 * This software is distributable under the BSD license. See the terms of the
 * BSD license in the documentation provided with this software.
 */

public class Main {
    /**
     * Returns <code>true</code> if the given string starts with an uppercase letter.
     *
     * @param str string to check.
     *
     * @return <code>true</code> if the given string starts with an uppercase letter.
     */
    public static boolean startsWithUppercase(String str) {
        if (str.length() == 0) {
            return false;
        }

        return isUppercase(str.charAt(0));
    }

    /**
     * Returns <code>true</code> if the given letter is uppercase.
     *
     * @param letter letter to check for capitalization.
     *
     * @return <code>true</code> if the given letter is uppercase.
     */
    public static boolean isUppercase(char letter) {
        if ((letter < 'A') || (letter > 'Z')) {
            return false;
        }

        return true;
    }
}

Related

  1. startsWithSlash(String path)
  2. startsWithSlash(String url)
  3. startsWithSpace(String s)
  4. startsWithSpaces(final String text)
  5. startsWithTag(String html, int position)
  6. startsWithUpperCase(String text)
  7. startsWithURIScheme(String arg)
  8. startsWithVowel(String string)
  9. startsWithVowel(String text)