Java String Capitalize First CapitalizeFirstLetter(String name)

Here you can find the source of CapitalizeFirstLetter(String name)

Description

Capitalize First Letter

License

Open Source License

Declaration

public static String CapitalizeFirstLetter(String name) 

Method Source Code

//package com.java2s;
/**********************************************************************************
 * 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
 *
 * Icons under 'icons/fugue' are made by Yusuke Kamiyamane http://www.pinvoke.com/.
 * Licensed under a Creative Commons Attribution 3.0 license.
 * <http://creativecommons.org/licenses/by/3.0/>
 *
 *********************************************************************************/

public class Main {
    public static String CapitalizeFirstLetter(String name) {
        if (name == null)
            return null;
        String firstLetter = name.substring(0, 1);
        String remainder = name.substring(1);
        String capitalized = firstLetter.toUpperCase()
                + remainder.toLowerCase();
        return capitalized;

    }//  www .  ja  va2s.  c o m
}

Related

  1. capitalizeFirstLetter(final String variableName)
  2. capitalizeFirstLetter(String data)
  3. capitalizeFirstLetter(String data)
  4. capitalizeFirstLetter(String data)
  5. capitalizeFirstLetter(String message)
  6. capitalizeFirstLetter(String s)
  7. capitalizeFirstLetter(String s)
  8. capitalizeFirstLetter(String s)
  9. capitalizeFirstLetter(String s)