Java Utililty Methods String Underscore to

List of utility methods to do String Underscore to

Description

The list of methods to do String Underscore to are organized into topic(s).

Method

Stringunderscore2camel(String underscoreName)
convert underscore name to camel name
String[] sections = underscoreName.split("_");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < sections.length; i++) {
    String s = sections[i];
    if (i == 0) {
        sb.append(s);
    } else {
        sb.append(capitalize(s));
...
StringunderScore2CamelCase(String strs)
under Score Camel Case
if (strs == null || !strs.contains("_")) {
    return strs;
StringBuilder sb = new StringBuilder("");
String[] elems = strs.split("_");
for (int i = 0; i < elems.length; i++) {
    String elem = elems[i].toLowerCase();
    if (i != 0) {
...
StringunderscoreDashToCamelCase(String s)
underscore Dash To Camel Case
String[] parts = s.split("[_-]");
StringBuilder builder = new StringBuilder();
for (String part : parts) {
    builder.append(capitalized(part));
return builder.toString();
StringunderscoresToCamelCaseImpl(String input, boolean capNextLetter)
underscores To Camel Case Impl
StringBuilder result = new StringBuilder();
char[] chars = input.toCharArray();
for (int i = 0; i < chars.length; ++i) {
    if ('a' <= chars[i] && chars[i] <= 'z') {
        if (capNextLetter) {
            result.append((char) (chars[i] + ('A' - 'a')));
        } else {
            result.append(chars[i]);
...
StringunderscoresToSpaces(String value)
underscores To Spaces
if (value == null) {
    throw new IllegalArgumentException("Passed value can not be null.");
return underscoresToSpaces(value, true);
StringunderscoreToCamel(String input, boolean firstLetterUppercase)
underscore To Camel
if (input == null)
    return null;
StringBuilder builder = new StringBuilder();
boolean firstFound = false;
boolean capitalizeNext = firstLetterUppercase;
for (char c : input.toCharArray()) {
    if (c == '_') {
        if (firstFound) {
...
StringunderscoreToCamelCase(String wordConstruct)
Receives a word construct split in underscores and converts it to camelCase.
String[] words = wordConstruct.split("_");
String camelCaseWordConstruct = "";
for (String word : words) {
    if (!camelCaseWordConstruct.equals("")) {
        if (!word.equals(""))
            camelCaseWordConstruct += word.substring(0, 1).toUpperCase() + word.substring(1);
    } else
        camelCaseWordConstruct += word;
...
StringunderscoreToPascalCase(final String str)
underscore To Pascal Case
return underscoreTo(str, true);
StringunderscoreToSpace(String text)
Substitutes all underscores by space character
return text.replace('_', ' ');
StringunderscoreToSpace(String value)
underscore To Space
if (value == null) {
    throw new IllegalArgumentException("Passed value can not be null.");
return underscoresToSpaces(value, false);