Here you can find the source of capitalizeFirstLetter(String message)
Parameter | Description |
---|---|
message | The message to convert. |
public static final String capitalizeFirstLetter(String message)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . ja va 2 s .co m*/ * Capitalizes the first letter of the message and returns the result. If * the argument is null, then null is returned. If the first letter is * capitalized this will return an identical string. If the string is empty * then it will return the same empty string back. * * @param message The message to convert. * * @return The converted message, or null if the argument is null. */ public static final String capitalizeFirstLetter(String message) { if (message == null || message.length() == 0) { return message; } char firstUpperCaseLetter = Character.toUpperCase(message.charAt(0)); String remainderOfMessage = message.substring(1); return firstUpperCaseLetter + remainderOfMessage; } }