Here you can find the source of toLowerCase(String text)
Parameter | Description |
---|---|
text | a parameter |
public static String toLowerCase(String text)
//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; } }