String split Camel Case by regex - Android java.util.regex

Android examples for java.util.regex:Character Pattern

Description

String split Camel Case by regex

Demo Code


public class Main{

    private static String splitCamelCase(String s) {
        return s.replaceAll(String.format("%s|%s|%s",
                "(?<=[A-Z])(?=[A-Z][a-z])", "(?<=[^A-Z])(?=[A-Z])",
                "(?<=[A-Za-z])(?=[^A-Za-z])"), " ");
    }//from   www. ja va  2s  .c  o  m

}

Related Tutorials