Java String Capitalize capitalize(StringBuilder text)

Here you can find the source of capitalize(StringBuilder text)

Description

capitalize

License

Open Source License

Declaration

public static void capitalize(StringBuilder text) 

Method Source Code

//package com.java2s;
/*//  w  ww .  j a va  2s  .  com
 * This file is part of SimpleClans2 (2012).
 *
 *     SimpleClans2 is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     SimpleClans2 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 General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with SimpleClans2.  If not, see <http://www.gnu.org/licenses/>.
 *
 *     Last modified: 10.10.12 21:57
 */

public class Main {
    public static void capitalize(StringBuilder text) {
        if (text.length() == 0) {
            return;
        }

        text.setCharAt(0, Character.toUpperCase(text.charAt(0)));
    }

    public static String capitalize(String text) {
        StringBuilder builder = new StringBuilder(text);
        capitalize(builder);
        return builder.toString();
    }
}

Related

  1. capitalize(String word)
  2. capitalize(String word)
  3. capitalize(String word)
  4. capitalize(String word)
  5. capitalize(String words)
  6. capitalizeAt(StringBuilder builder, int index)
  7. capitalizeClass(String className)
  8. capitalized(String s)
  9. capitalized(String s)