capitalize First character - Android java.lang

Android examples for java.lang:String Case

Description

capitalize First character

Demo Code

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Main{

    /**// ww w. j  a v a  2  s. c  o  m
     * Capitalise the first character of the description, for style
     *
     * @param orig original string
     * @return same string as orig, except the first letter is capitalized
     */
    public static String capitalizeFirstChar(@NonNull String orig) {
        return orig.substring(0, 1).toUpperCase() + orig.substring(1);
    }

}

Related Tutorials