Here you can find the source of capitalize(String word)
Parameter | Description |
---|---|
word | a parameter |
public static String capitalize(String word)
//package com.java2s; public class Main { /**//w ww.j a va2 s.c o m * @param word * @return the word with the first character capitalized, if applicable */ public static String capitalize(String word) { String capitalizedWord = word; if (Character.isLowerCase(word.charAt(0))) { capitalizedWord = "" + Character.toUpperCase(word.charAt(0)) + word.substring(1); } return capitalizedWord; } }