Java Utililty Methods String Camel to Hyphen

List of utility methods to do String Camel to Hyphen

Description

The list of methods to do String Camel to Hyphen are organized into topic(s).

Method

StringcamelCaseToHyphenated(String s)
Transforms a string from camel-case to lower-case with hyphens.
return s.replaceAll("([^^])([A-Z][a-z])", "$1-$2").toLowerCase();
StringcamelCaseToHyphenCase(String s)
Parse upper camel case to lower hyphen case.
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
    if (Character.isUpperCase(c)) {
        parsedString.append("-").append(Character.toLowerCase(c));
    } else {
        parsedString.append(c);
return parsedString.toString();
StringcamelCaseToHyphens(String s)
camel Case To Hyphens
String[] pieces = splitCamelCase(s);
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String piece : pieces) {
    if (first) {
        first = false;
    } else {
        sb.append("-");
...