Java Field Name Get fieldName(String underScore)

Here you can find the source of fieldName(String underScore)

Description

field Name

License

Apache License

Declaration

public static String fieldName(String underScore) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String fieldName(String underScore) {
        StringBuilder name = new StringBuilder();

        underScore = underScore.toLowerCase();

        boolean isUnderScore = false;

        for (int i = 0; i < underScore.length(); i++) {
            char spell = underScore.charAt(i);

            if (isUnderScore) {
                name.append(Character.toUpperCase(spell));
                isUnderScore = false;//from w  w  w  .j a  v  a 2s  . c o  m
            } else {
                if (spell == '_') {
                    isUnderScore = true;
                } else {
                    name.append(spell);
                }
            }
        }
        return name.toString();
    }
}

Related

  1. fieldName(String className, String rawFieldName)
  2. fieldName(String fieldName, String propName)
  3. fieldName(String getsetName)
  4. fieldName(String name)
  5. fieldName(String nodeName)
  6. fieldNameFromPropertyName(final String propertyName)
  7. fieldNameMatchesProperty(final String name, final String property)
  8. fieldNameToConstant(String fieldname)
  9. fieldNameToMethodName(String methodPrefix, String fieldName)