List of utility methods to do String Camel Case Format
String | toCamelCase(String columnName) to Camel Case return toCamelCase(columnName, false);
|
String | toCamelCase(String dashCase) to Camel Case String[] parts = dashCase.toLowerCase().split("[- ]+"); StringBuilder builder = new StringBuilder(); for (String part : parts) { if (part.length() > 0) { builder.append(part.substring(0, 1).toUpperCase()); builder.append(part.substring(1)); if (builder.length() > 0) { String firstChar = builder.substring(0, 1).toLowerCase(); builder.replace(0, 1, firstChar); return builder.toString(); |
String | toCamelCase(String id) Convert an identifier into CamelCase, by capitalizing the first letter and the letter following all underscores, and then removing all underscores. int N = id.length(); StringBuilder sb = new StringBuilder(2 * N); boolean makeUpper = true; for (int i = 0; i < N; i++) { char ch = id.charAt(i); if (ch == '_') { makeUpper = true; } else { ... |
String | toCamelCase(String in, boolean startWithUpper) Returns a camel case formatted representation of the String passed in. StringBuilder builder = new StringBuilder(); int length = in.length(); boolean nextUpper = startWithUpper; for (int i = 0; i < length; i++) { char c = in.charAt(i); if (c == '-' || c == '_' || c == '#' || c == '.') { nextUpper = true; } else { ... |
String | toCamelCase(String input) to Camel Case String inputLowerCase = input.toLowerCase(); StringBuilder sb = new StringBuilder(); final char delim = '_'; char value; boolean capitalize = false; for (int i = 0; i < inputLowerCase.length(); ++i) { value = inputLowerCase.charAt(i); if (value == delim) { ... |
String | toCamelCase(String input) Transform a dashed input into camelcased String newinput = ""; for (int i = 0; i < input.length(); i++) { char theChar = input.charAt(i); if (theChar == '-') { newinput += input.substring(i + 1, i + 2).toUpperCase(); i += 1; } else { newinput += theChar; ... |
String | toCamelCase(String input) to Camel Case if (input == null) { return null; StringBuffer result = new StringBuffer(); result.append(input.substring(0, 1).toUpperCase()); result.append(input.substring(1).toLowerCase()); return result.toString(); |
String | toCamelCase(String input, boolean capitalizeFirsLetter) Converts a string to camel case, so "Get \"some\" 'big' object" becomes "getSomeObject". if (input == null) return null; input = input.replaceAll("[^A-Za-z0-9 ]", "").trim(); StringBuilder result = new StringBuilder(input.length()); char[] chars = input.toCharArray(); for (int n = 0; n < chars.length; n++) { if (n == 0) { result.append( ... |
String | toCamelCase(String input, boolean firstCharUppercase, char separator) to Camel Case int length = input.length(); StringBuilder sb = new StringBuilder(length); boolean upperCase = firstCharUppercase; for (int i = 0; i < length; i++) { char ch = input.charAt(i); if (ch == separator) { upperCase = true; } else if (upperCase) { ... |
String | toCamelCase(String inputString) to Camel Case String result = ""; if (inputString.length() == 0) { return result; char firstChar = inputString.charAt(0); char firstCharToUpperCase = Character.toUpperCase(firstChar); result = result + firstCharToUpperCase; for (int i = 1; i < inputString.length(); i++) { ... |