Here you can find the source of capitalizeFirstCharOfString(final String input)
Parameter | Description |
---|---|
input | the string to be processed; |
static String capitalizeFirstCharOfString(final String input)
//package com.java2s; //License from project: Open Source License public class Main { /**/* www. java 2 s .co m*/ * Capitalizes first char of an input string. * * @param input the string to be processed; * @return The input string with the first capitalized char. Returns empty string, if passed input String is null or empty. */ static String capitalizeFirstCharOfString(final String input) { if (input == null || input.length() == 0) { return ""; } else if (input.length() == 1) { return input.toUpperCase(); } else { return input.substring(0, 1).toUpperCase() + input.substring(1); } } }