uncapitalize a string - Android java.lang

Android examples for java.lang:String Case

Description

uncapitalize a string

Demo Code

import java.lang.reflect.InvocationTargetException;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;

public class Main{

    public static String uncapitalize(String str) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return str;
        }/*from   w  w  w  .  j  av  a 2 s. com*/
        return new StringBuilder(strLen)
                .append(Character.toLowerCase(str.charAt(0)))
                .append(str.substring(1)).toString();
    }

}

Related Tutorials