Here you can find the source of toUpperCaseFirstChar(final String str)
Parameter | Description |
---|---|
str | the string |
public static String toUpperCaseFirstChar(final String str)
//package com.java2s; /* ****************************************************************************** * Copyright (c) 2011 SouthEdge Software and Consultancy. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/* w w w . ja v a 2s. co m*/ * Carl Frendo - initial design and implementation * ******************************************************************************/ public class Main { /** * Method used to change to upper case the first character of a given string. * * @param str the string * @return str with the first character of the string in upper case. */ public static String toUpperCaseFirstChar(final String str) { String firstChar = str.substring(0, 1); firstChar = firstChar.toUpperCase(); String lastChars = str.substring(1, str.length()); return firstChar + lastChars; } }