Java String Capitalize capitalize(String original)

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

Description

capitalize

License

LGPL

Declaration

private static String capitalize(String original) 

Method Source Code

//package com.java2s;
/*/* ww  w.j a  va  2  s.c  om*/
 * Copyright (C) 2007-2010 J?lio Vilmar Gesser.
 * Copyright (C) 2011, 2013-2016 The JavaParser Team.
 *
 * This file is part of JavaParser.
 *
 * JavaParser can be used either under the terms of
 * a) the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * b) the terms of the Apache License
 *
 * You should have received a copy of both licenses in LICENCE.LGPL and
 * LICENCE.APACHE. Please refer to those files for details.
 *
 * JavaParser 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
 * GNU Lesser General Public License for more details.
 */

public class Main {
    private static String capitalize(String original) {
        if (original.length() < 1) {
            throw new IllegalArgumentException("This string is empty");
        } else if (original.length() == 1) {
            return original.toUpperCase();
        } else {
            return original.substring(0, 1).toUpperCase() + original.substring(1);
        }
    }
}

Related

  1. capitalize(String name)
  2. capitalize(String name)
  3. capitalize(String name)
  4. capitalize(String name)
  5. capitalize(String orig)
  6. capitalize(String propertyName)
  7. capitalize(String pString)
  8. capitalize(String s)
  9. capitalize(String s)