Here you can find the source of toTitleCase(String str)
Parameter | Description |
---|---|
str | The string |
public static String toTitleCase(String str)
//package com.java2s; /*/*from ww w .j a v a2s . com*/ Copyright 2007-2009 QSpin - www.qspin.be This file is part of QTaste framework. QTaste is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QTaste is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with QTaste. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Converts the specified string to title case, by capitalizing the * first letter. * @param str The string * @since jEdit 4.0pre1 */ public static String toTitleCase(String str) { if (str.length() == 0) return str; else { return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase(); } } }