Here you can find the source of capitalizeClass(String className)
Parameter | Description |
---|---|
className | The class name to capitalize. |
className
class name.
public static String capitalizeClass(String className)
//package com.java2s; /*//from ww w . j av a2 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 { /** * Capitalizes a full qualified class name. * Example: * <code>WebMotionUtils.capitalizeClass("org.webmotion.myclass")</code> will return * <code>"org.webmotion.Myclass"</code> * @param className The class name to capitalize. * @return A capitalized representation for the given <code>className</code> class name. */ public static String capitalizeClass(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.toUpperCase(className.charAt(packageIndex + 1))); builder.append(className.substring(packageIndex + 2)); className = builder.toString(); return className; } }