Java String Capitalize capitalize(String text)

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

Description

capitalize

License

Apache License

Declaration

public static String capitalize(String text) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String capitalize(String text) {
        if (text == null) {
            return null;
        }/*  www.j  a  v a2  s . c  o  m*/
        int length = text.length();
        if (length == 0) {
            return text;
        }
        String answer = text.substring(0, 1).toUpperCase();
        if (length > 1) {
            answer += text.substring(1, length);
        }
        return answer;
    }
}

Related

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