Java String Camel Case to Underscore camelCaseToUnderscores(String camel)

Here you can find the source of camelCaseToUnderscores(String camel)

Description

camel Case To Underscores

License

Open Source License

Declaration

public static String camelCaseToUnderscores(String camel) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String camelCaseToUnderscores(String camel) {
        String underscore;/*from w w w  . ja  v  a 2  s. c  o  m*/
        underscore = String.valueOf(Character.toLowerCase(camel.charAt(0)));
        for (int i = 1; i < camel.length(); i++) {
            underscore += Character.isLowerCase(camel.charAt(i)) ? String
                    .valueOf(camel.charAt(i))
                    : "_"
                            + String.valueOf(Character.toLowerCase(camel
                                    .charAt(i)));
        }
        return underscore;
    }
}

Related

  1. camelCaseToUnderscore(final String str)
  2. camelCaseToUnderscore(String camelCase)
  3. camelCaseToUnderscore(String camelCased)
  4. camelCaseToUnderScore(String key)
  5. camelCaseToUnderscored(String camelCaseName)
  6. camelCaseToUnderScoreUpperCase(String camelCase)
  7. camelToUnder(String value)
  8. camelToUnderline(String param)
  9. camelToUnderlinedName(String name)