Java String Camel Case To camelCase2Delimiter(String name, char delimiter)

Here you can find the source of camelCase2Delimiter(String name, char delimiter)

Description

camel Case Delimiter

License

Apache License

Declaration

private static String camelCase2Delimiter(String name, char delimiter) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static String camelCase2Delimiter(String name, char delimiter) {
        if (name == null || !name.matches(".*[A-Z].*") || !name.matches(".*[a-z].*"))
            return name;

        String regex = "([a-zA-Z])([A-Z])";
        String replacement = "$1" + delimiter + "$2";

        return name.replaceAll(regex, replacement).replaceAll(regex, replacement);
    }// ww  w.  ja v a 2  s.c  o m
}

Related

  1. camel2underline(String hump)
  2. camel2underline(String s)
  3. camelCaseIt(String mappingName, String separator)
  4. camelCaseMatch(String word, String abbr)
  5. camelCaseNameToConstant(String camelCaseName)
  6. camelCaseOrSpaceToDashed(String s)