Here you can find the source of capitalize(String str)
Parameter | Description |
---|---|
str | the string. |
public static String capitalize(String str)
//package com.java2s; public class Main { /**//from w w w.j a v a 2 s . c o m * Capitalize given string by transforming the first character to upper case. * * @param str the string. * @return the capitalized string. */ public static String capitalize(String str) { StringBuilder buff = new StringBuilder(str.length()); buff.append(Character.toUpperCase(str.charAt(0))); buff.append(str.substring(1)); return buff.toString(); } }