Java String Capitalize capitalize(String input)

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

Description

capitalize

License

Open Source License

Declaration

public static String capitalize(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String capitalize(String input) {
        int length;

        if (input == null || (length = input.length()) == 0) {
            return "";
        } else if (length > 1) {
            return input.substring(0, 1).toUpperCase().concat(input.substring(1));
        } else {/*from  w  ww  .j  a v  a2  s .  c om*/
            return input.toUpperCase();
        }
    }
}

Related

  1. capitalize(String input)
  2. capitalize(String input)
  3. capitalize(String input)
  4. capitalize(String input)
  5. capitalize(String input)
  6. capitalize(String input)
  7. capitalize(String input)
  8. capitalize(String inputString)
  9. capitalize(String line)