Here you can find the source of startsWithUppercase(String str)
true
if the given string starts with an uppercase letter.
Parameter | Description |
---|---|
str | string to check. |
true
if the given string starts with an uppercase letter.
public static boolean startsWithUppercase(String str)
//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; } }