Java Field Name Get fieldNameToConstant(String fieldname)

Here you can find the source of fieldNameToConstant(String fieldname)

Description

field Name To Constant

License

Open Source License

Declaration

public static String fieldNameToConstant(String fieldname) 

Method Source Code

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

public class Main {
    public static String fieldNameToConstant(String fieldname) {
        return camelCaseNameToConstant(fieldname);
    }/*from   w w  w  .ja  v a  2  s  .c  o  m*/

    private static String camelCaseNameToConstant(String camelCaseName) {
        if (camelCaseName == null || camelCaseName.isEmpty()) {
            return camelCaseName;
        }

        return camelCaseName.replaceAll("([a-z]{1})([A-Z]{1})", "$1_$2").toUpperCase();
    }
}

Related

  1. fieldName(String name)
  2. fieldName(String nodeName)
  3. fieldName(String underScore)
  4. fieldNameFromPropertyName(final String propertyName)
  5. fieldNameMatchesProperty(final String name, final String property)
  6. fieldNameToMethodName(String methodPrefix, String fieldName)
  7. fieldNameToPath(String fieldName)