Java String Lower Case toLowerCase(String text)

Here you can find the source of toLowerCase(String text)

Description

to upper case like xxx_xxx_xxx

License

Apache License

Parameter

Parameter Description
text a parameter

Declaration

public static String toLowerCase(String text) 

Method Source Code

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

public class Main {
    /**//from   w  ww .j av  a  2 s .  c  om
     * to upper case like xxx_xxx_xxx
     * 
     * @param text
     * @return
     */
    public static String toLowerCase(String text) {
        if (text != null && text.length() > 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < text.length(); i++) {
                char c = text.charAt(i);
                if (i != 0 && Character.isUpperCase(c)) {
                    sb.append("_");
                }
                sb.append(Character.toLowerCase(c));
            }

            return sb.toString();
        }
        return text;
    }
}

Related

  1. toLowerCase(String str)
  2. toLowerCase(String str)
  3. toLowerCase(String string)
  4. toLowerCase(String string)
  5. toLowerCase(String text)
  6. toLowerCase(String text)
  7. toLowerCase(String value)
  8. toLowerCase(String value)
  9. toLowerCase(String[] strArr)