Here you can find the source of camelCaseToLowerCaseUnderline(String name)
public static String camelCaseToLowerCaseUnderline(String name)
//package com.java2s; /**/* www . j a va 2s . c o m*/ * Copyright (C) 2006 - present David Bulmore * All Rights Reserved. * * This file is part of Easy Java Persistence. * * EJP is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the accompanying license * for more details. * * You should have received a copy of the license along with EJP; if not, * go to http://www.EasierJava.com and download the latest version. */ public class Main { public static String camelCaseToLowerCaseUnderline(String name) { StringBuilder newName = new StringBuilder(); for (int i = 0; i < name.length(); i++) if (Character.isUpperCase(name.charAt(i))) { if (i == 0) newName.append(Character.toLowerCase(name.charAt(i))); else newName.append("_").append(Character.toLowerCase(name.charAt(i))); } else newName.append(name.charAt(i)); return newName.toString(); } public static String toString(Object[] objects) { StringBuilder str = new StringBuilder(); if (objects != null) for (int i = 0; i < objects.length; i++) str.append("[").append(objects[i]).append("]").append(i < objects.length - 1 ? ", " : ""); return str.toString(); } }