Java String Uncapitalize unCapitalizeClass(String className)

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

Description

Uncapitalizes a full qualified class name.

License

Open Source License

Parameter

Parameter Description
className The class name to uncapitalize.

Return

A uncapitalized representation for the given className class name.

Declaration

public static String unCapitalizeClass(String className) 

Method Source Code

//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;
    }
}

Related

  1. uncapitalize(String string)
  2. unCapitalize(String string)
  3. uncapitalize(String string)
  4. uncapitalize(String string0)
  5. uncapitalize(String text)
  6. uncapitalized(String aString)
  7. uncapitalizeFirstLetter(String s)
  8. uncapitalizeFirstLetter(String str)
  9. uncapitalizeFirstLetter(String value)