Java String Capitalize capitalize(final String name)

Here you can find the source of capitalize(final String name)

Description

capitalize

License

Open Source License

Declaration

public static String capitalize(final String name) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2014, 2015 QPark Consulting S.a r.l. This program and the
 * accompanying materials are made available under the terms of the Eclipse
 * Public License v1.0. The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html.
 ******************************************************************************/

public class Main {
    public static String capitalize(final String name) {
        String s = name;//  w  w w  . ja  v a  2 s.  c  o m
        if (s != null && s.length() > 0) {
            StringBuffer sb = new StringBuffer(s.length());
            sb.append(s.substring(0, 1).toUpperCase());
            if (s.length() > 1) {
                sb.append(s.substring(1, s.length()));
            }
            s = sb.toString();
        }
        return s;
    }
}

Related

  1. capitalizarTexto(String texto)
  2. capitalize(CharSequence s)
  3. capitalize(CharSequence s)
  4. capitalize(final String docName)
  5. capitalize(final String input)
  6. capitalize(final String s)
  7. capitalize(final String s)
  8. capitalize(final String s)
  9. capitalize(final String s)