Java String Camel Case to Upper Case camelToUpper(String camel)

Here you can find the source of camelToUpper(String camel)

Description

Convert CamelCase strings to ALL_UPPERCASE_WITH_UNDERSCORES.

License

Open Source License

Parameter

Parameter Description
camel a parameter

Declaration

public static String camelToUpper(String camel) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from w  ww.j  a v a  2 s  .  com*/
     * Convert CamelCase strings to ALL_UPPERCASE_WITH_UNDERSCORES.
     * @param camel
     * @return
     */
    public static String camelToUpper(String camel) {
        return camel.replaceAll("([A-Z][a-z0-9])", "_$1").substring(1).toUpperCase();
    }
}

Related

  1. camelCaseToUpperCase(final String camelCase)
  2. camelCaseToUpperCase(String camelCaseName)
  3. camelCaseToUpperCase(String in)
  4. camelToUpper(String name)
  5. camelToUpper(String s)