Here you can find the source of fieldNameToConstant(String fieldname)
public static String fieldNameToConstant(String fieldname)
//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(); } }