Android String Camel Case camelify(String original)

Here you can find the source of camelify(String original)

Description

camelify

Declaration

public static String camelify(String original) 

Method Source Code

//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String camelify(String original) {
        if (original == null)
            return "";
        StringBuilder builder = new StringBuilder();
        Pattern p = Pattern.compile("[a-zA-Z0-9]+");
        Matcher m = p.matcher(original);
        String word;/*w w  w. j  av  a  2s  .c  om*/
        while (m.find()) {
            word = m.group();
            builder.append(capitalize(word));
        }
        return builder.toString();
    }

    private static String capitalize(String string) {
        if (string.length() > 1)
            return string.substring(0, 1).toUpperCase()
                    + string.substring(1);
        return "";
    }
}

Related

  1. decamelize(final String s)
  2. snakify(String original)