first Letter To Upper Case - Android java.lang

Android examples for java.lang:String Case

Description

first Letter To Upper Case

Demo Code

import android.util.Log;
import java.net.URLDecoder;
import java.util.Collection;
import java.util.regex.Pattern;

public class Main{

    public static String firstLetterToUpperCase(String pWord) {
        pWord = pWord == null ? "" : pWord;
        String output = "";
        for (int i = 0; i < pWord.length(); i++) {
            if (i == 0) {
                output += Character.toUpperCase(pWord.charAt(i));
            } else {
                output += Character.toLowerCase(pWord.charAt(i));
            }/*from   ww w.ja  va  2 s .co  m*/
        }
        return output;
    }

}

Related Tutorials