Here you can find the source of unCapitalizeClass(String className)
Parameter | Description |
---|---|
className | The class name to uncapitalize. |
className
class name.
public static String unCapitalizeClass(String className)
//package com.java2s; /*//w w w .j a va 2 s. c o m * #%L * Webmotion server * * $Id$ * $HeadURL$ * %% * Copyright (C) 2011 - 2015 Debux * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 * GNU General Lesser Public License for more details. * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ public class Main { /** * Uncapitalizes a full qualified class name. * Example: * <code>WebMotionUtils.unCapitalizeClass("org.webmotion.Myclass")</code> will return * <code>"org.webmotion.myclass"</code> * @param className The class name to uncapitalize. * @return A uncapitalized representation for the given <code>className</code> class name. */ public static String unCapitalizeClass(String className) { StringBuilder builder = new StringBuilder(className.length()); // Search the class name in package int packageIndex = className.lastIndexOf("."); if (packageIndex != -1) { builder.append(className.substring(0, packageIndex + 1)); } builder.append(Character.toLowerCase(className.charAt(packageIndex + 1))); builder.append(className.substring(packageIndex + 2)); className = builder.toString(); return className; } }