Java Char Lower Case toLowerCaseFirstChar(final String str)

Here you can find the source of toLowerCaseFirstChar(final String str)

Description

Method used to change to lower case the first character of a given string.

License

Open Source License

Parameter

Parameter Description
str the string

Return

str with the first character of the string in lower case.

Declaration

public static String toLowerCaseFirstChar(final String str) 

Method Source Code

//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:/*from   w  ww. j  a v  a  2  s .c  o  m*/
 *     Carl Frendo - initial design and implementation
 * ******************************************************************************/

public class Main {
    /**
     * Method used to change to lower case the first character of a given string.
     * 
     * @param str the string
     * @return str with the first character of the string in lower case.
     */
    public static String toLowerCaseFirstChar(final String str) {
        String firstChar = str.substring(0, 1);
        firstChar = firstChar.toLowerCase();
        String lastChars = str.substring(1, str.length());
        return firstChar + lastChars;
    }
}

Related

  1. toLowerCase(final char a)
  2. toLowerCase(final char c)
  3. toLowerCase(final char[] buffer, final int offset, final int limit)
  4. toLowerCase(int character_)
  5. toLowerCaseAtFirstChar(String string)
  6. toLowerCaseFirstChar(String str)
  7. toLowerCaseFirstChar(String string)
  8. toLowercaseFirstCharacter(String s)
  9. toLowercaseFirstCharUppercase(final String string)