capitalize a string with substring method - Android java.lang

Android examples for java.lang:String Case

Description

capitalize a string with substring method

Demo Code


public class Main{

    public static String capitalize(String str) {
        return str.substring(0, 1).toUpperCase() + str.substring(1);
    }//from   w ww. j  av  a 2 s  .c o  m

}

Related Tutorials