Here you can find the source of capitalizeFirstLetter(String s)
Parameter | Description |
---|---|
s | the string to modify |
s
with the first letter capitalized
public static String capitalizeFirstLetter(String s)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w. j a v a2s. c o m * @param s the string to modify * @return <code>s</code> with the first letter capitalized */ public static String capitalizeFirstLetter(String s) { if (s == null || s.isEmpty()) return s; return s.length() == 1 ? s.toUpperCase() : s.substring(0, 1).toUpperCase() + s.substring(1); } }