Java String Capitalize capitalizePackageName(final String packageName)

Here you can find the source of capitalizePackageName(final String packageName)

Description

capitalize Package Name

License

Open Source License

Declaration

public static String capitalizePackageName(final String packageName) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2014, 2015 QPark Consulting S.a r.l. This program and the
 * accompanying materials are made available under the terms of the Eclipse
 * Public License v1.0. The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html.
 ******************************************************************************/

public class Main {
    public static String capitalizePackageName(final String packageName) {
        String s = packageName;/*from   w  ww .j  a va2 s.  co m*/
        if (packageName != null) {
            String[] ss = packageName.replaceAll("-", ".").split("\\.");
            StringBuffer sb = new StringBuffer(packageName.length());
            for (String sx : ss) {
                if (sx.length() > 0) {
                    sb.append(sx.substring(0, 1).toUpperCase());
                    if (sx.length() > 1) {
                        sb.append(sx.substring(1, sx.length()));
                    }
                }
            }
            s = sb.toString();
        }
        return s;
    }
}

Related

  1. capitalizeInitial(String str)
  2. capitalizeMessage(String message)
  3. capitalizeMethodName(String methodName)
  4. capitalizeName(final String name)
  5. capitalizeName(String name)
  6. capitalizePlayerName(String name)
  7. capitalizePropertyName(String propertyName)
  8. capitalizePropertyName(String s)
  9. capitalizeString(final String in)