convert string separated by underscore To Camel Case - Android java.lang

Android examples for java.lang:String Case

Description

convert string separated by underscore To Camel Case

Demo Code


public class Main{

    public static String convertToCamelCase(String input) {
        String[] parts = input.split("_");
        String camelCaseString = "";
        for (int i = 0; i < parts.length; i++) {
            String part = parts[i];
            camelCaseString = camelCaseString
                    + ((i == 0) ? part.toLowerCase() : toProperCase(part));
            //            camelCaseString = camelCaseString + toProperCase(part);
        }// w w  w  .j  a  va  2s . c o  m
        return camelCaseString;
    }

}

Related Tutorials