Java String Upper Case toUpperCaseAtFirstChar(String string)

Here you can find the source of toUpperCaseAtFirstChar(String string)

Description

to Upper Case At First Char

License

Open Source License

Declaration

public static String toUpperCaseAtFirstChar(String string) 

Method Source Code

//package com.java2s;
/**/*  w ww  . j  a  v a  2 s.c o  m*/
 * Copyright (c) 2015 SK holdings Co., Ltd. All rights reserved.
 * This software is the confidential and proprietary information of SK holdings.
 * You shall not disclose such confidential information and shall use it only in
 * accordance with the terms of the license agreement you entered into with SK holdings.
 * (http://www.eclipse.org/legal/epl-v10.html)
 */

public class Main {

    public static String toUpperCaseAtFirstChar(String string) {
        if (isEmpty(string)) {
            return "";
        }

        StringBuffer buffer = new StringBuffer();

        buffer.append(string.substring(0, 1).toUpperCase());
        buffer.append(string.substring(1, string.length()));

        return buffer.toString();
    }

    public static boolean isEmpty(String string) {

        return string == null || string.equals("") ? true : false;
    }
}

Related

  1. toUpperCase(StringBuffer buf)
  2. toUppercaseAndUnderscore(String string)
  3. toUpperCaseArray(String[] source, String[] target)
  4. toUpperCaseAscii(String s)
  5. toUpperCaseAt(String oldString, int index)
  6. toUpperCaseFirst(String str)
  7. toUpperCaseFirst(String str)
  8. toUpperCaseFirst(String str)
  9. toUpperCaseFirst(String text)