Java Utililty Methods String Underscore to

List of utility methods to do String Underscore to

  1. HOME
  2. Java
  3. S
  4. String Underscore to

Description

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

Method

String underscore2camel(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));
...
String underScore2CamelCase(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) {
...
String underscoreDashToCamelCase(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();
String underscoresToCamelCaseImpl(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]);
...
String underscoresToSpaces(String value)
underscores To Spaces
if (value == null) {
 throw new IllegalArgumentException("Passed value can not be null.");
return underscoresToSpaces(value, true);
String underscoreToCamel(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) {
...
String underscoreToCamelCase(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;
...
String underscoreToPascalCase(final String str)
underscore To Pascal Case
return underscoreTo(str, true);
String underscoreToSpace(String text)
Substitutes all underscores by space character
return text.replace('_', ' ');
String underscoreToSpace(String value)
underscore To Space
if (value == null) {
 throw new IllegalArgumentException("Passed value can not be null.");
return underscoresToSpaces(value, false);


AltStyle によって変換されたページ (->オリジナル) /