Java String Capitalize capitalized(String str)

Here you can find the source of capitalized(String str)

Description

capitalized

License

EUPL

Declaration

public static String capitalized(String str) 

Method Source Code

//package com.java2s;
/*/*from w  ww .ja va  2s  .  c o  m*/
 * Copyright (c) 2013 The Finnish National Board of Education - Opetushallitus
 *
 * This program is free software: Licensed under the EUPL, Version 1.1 or - as
 * soon as they will be approved by the European Commission - subsequent versions
 * of the EUPL (the "Licence");
 *
 * You may not use this work except in compliance with the Licence.
 * You may obtain a copy of the Licence at: http://www.osor.eu/eupl/
 *
 * This program 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
 * European Union Public Licence for more details.
 */

public class Main {
    public static String capitalized(String str) {
        if (str == null) {
            return null;
        }
        if (str.length() > 0) {
            return str.substring(0, 1).toUpperCase() + str.substring(1);
        }
        return str;
    }
}

Related

  1. capitalize(StringBuilder text)
  2. capitalizeAt(StringBuilder builder, int index)
  3. capitalizeClass(String className)
  4. capitalized(String s)
  5. capitalized(String s)
  6. capitalizeD(String str, char[] delimiters)
  7. capitalizedArray(String[] sstr)
  8. capitalizedCase(CharSequence source, char... delimiters)
  9. capitalizedName(final String property)