Java String Lower Case toLowerCaseWithUnderscores(String className)

Here you can find the source of toLowerCaseWithUnderscores(String className)

Description

to Lower Case With Underscores

License

Apache License

Declaration

public static String toLowerCaseWithUnderscores(String className) 

Method Source Code

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

public class Main {
    public static String toLowerCaseWithUnderscores(String className) {
        StringBuilder sb = new StringBuilder();
        for (char c : className.toCharArray()) {
            if (c >= 'A' && c <= 'Z' && sb.length() > 0) {
                sb.append('_');
            }/*ww w  . j  a  v  a2  s .c om*/
            sb.append(Character.toLowerCase(c));
        }

        return sb.toString();
    }
}

Related

  1. toLowerCaseSafe(String str)
  2. toLowercaseSlug(String string)
  3. toLowerCaseSubsystemType(String s)
  4. toLowercaseWithDashes(String text)
  5. toLowerCaseWithSepStyle(String string, String separator)
  6. toLowerCaseWithUnderscores(String str)