Java String Capitalize capitalize(String value)

Here you can find the source of capitalize(String value)

Description

capitalize

License

sencha.com license

Declaration

public static String capitalize(String value) 

Method Source Code

//package com.java2s;
/**//w w  w.j ava  2s  .c  o m
 * Sencha GXT 3.0.1 - Sencha for GWT
 * Copyright(c) 2007-2012, Sencha, Inc.
 * licensing@sencha.com
 *
 * http://www.sencha.com/products/gxt/license/
 */

public class Main {
    public static String capitalize(String value) {
        int length = value.length();
        StringBuilder s = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            char c = value.charAt(i);
            if (i == 0) {
                c = Character.toUpperCase(c);
            } else {
                c = Character.toLowerCase(c);
            }
            s.append(c);
        }
        return s.toString();
    }
}

Related

  1. capitalize(String text)
  2. capitalize(String texte)
  3. capitalize(String to_capitalize)
  4. capitalize(String token)
  5. Capitalize(String val)
  6. capitalize(String value)
  7. capitalize(String value)
  8. capitalize(String value)
  9. capitalize(String var)