@Test public void testToCamelCaseAllWords(){ String camelcase="hello world"; String camelCaseWords=stringUtil.toCamelCaseAllWords(camelcase); Assert.assertEquals("Hello World",camelCaseWords); }
public String toCamelCaseAllWords(String str) { if (str == null) { return null; } str = str.trim().toLowerCase(); StringBuilder result = new StringBuilder(str.length()); boolean makeUpper = true; boolean lastCharSpace = true; for (int c = 0; c < str.length(); c++) { char ch = str.charAt(c); if (lastCharSpace && ch == ' ') { continue; } if (makeUpper) { result.append(str.substring(c, c + 1).toUpperCase()); makeUpper = false; } else { result.append(ch); } if (ch == ' ') { lastCharSpace = true; makeUpper = true; } else { lastCharSpace = false; } } return result.toString(); }
StringUtil implements Serializable { public String toCamelCaseAllWords(String str) { if (str == null) { return null; } str = str.trim().toLowerCase(); StringBuilder result = new StringBuilder(str.length()); boolean makeUpper = true; boolean lastCharSpace = true; for (int c = 0; c < str.length(); c++) { char ch = str.charAt(c); if (lastCharSpace && ch == ' ') { continue; } if (makeUpper) { result.append(str.substring(c, c + 1).toUpperCase()); makeUpper = false; } else { result.append(ch); } if (ch == ' ') { lastCharSpace = true; makeUpper = true; } else { lastCharSpace = false; } } return result.toString(); } }
StringUtil implements Serializable { public String toCamelCaseAllWords(String str) { if (str == null) { return null; } str = str.trim().toLowerCase(); StringBuilder result = new StringBuilder(str.length()); boolean makeUpper = true; boolean lastCharSpace = true; for (int c = 0; c < str.length(); c++) { char ch = str.charAt(c); if (lastCharSpace && ch == ' ') { continue; } if (makeUpper) { result.append(str.substring(c, c + 1).toUpperCase()); makeUpper = false; } else { result.append(ch); } if (ch == ' ') { lastCharSpace = true; makeUpper = true; } else { lastCharSpace = false; } } return result.toString(); } StringUtil(); }
StringUtil implements Serializable { public String toCamelCaseAllWords(String str) { if (str == null) { return null; } str = str.trim().toLowerCase(); StringBuilder result = new StringBuilder(str.length()); boolean makeUpper = true; boolean lastCharSpace = true; for (int c = 0; c < str.length(); c++) { char ch = str.charAt(c); if (lastCharSpace && ch == ' ') { continue; } if (makeUpper) { result.append(str.substring(c, c + 1).toUpperCase()); makeUpper = false; } else { result.append(ch); } if (ch == ' ') { lastCharSpace = true; makeUpper = true; } else { lastCharSpace = false; } } return result.toString(); } StringUtil(); boolean isEmpty(String str); boolean isEmptyOrWildcardAsterisk(String str); boolean equals(String str1, String str2); String toCamelCaseAllWords(String str); boolean validatePassword(String password, String[] invalidValues); boolean validateEmail(String emailAddress); boolean regExPatternMatch(String expression, String inputStr); boolean validateString(String regExStr, String str); String normalizeEmail(String email); String[] split(String value); String[] split(String value, String delimiter); static String trim(String str); boolean isValidName(String name); boolean isEmpty(List<?> list); String getValidUserName(String str); }
StringUtil implements Serializable { public String toCamelCaseAllWords(String str) { if (str == null) { return null; } str = str.trim().toLowerCase(); StringBuilder result = new StringBuilder(str.length()); boolean makeUpper = true; boolean lastCharSpace = true; for (int c = 0; c < str.length(); c++) { char ch = str.charAt(c); if (lastCharSpace && ch == ' ') { continue; } if (makeUpper) { result.append(str.substring(c, c + 1).toUpperCase()); makeUpper = false; } else { result.append(ch); } if (ch == ' ') { lastCharSpace = true; makeUpper = true; } else { lastCharSpace = false; } } return result.toString(); } StringUtil(); boolean isEmpty(String str); boolean isEmptyOrWildcardAsterisk(String str); boolean equals(String str1, String str2); String toCamelCaseAllWords(String str); boolean validatePassword(String password, String[] invalidValues); boolean validateEmail(String emailAddress); boolean regExPatternMatch(String expression, String inputStr); boolean validateString(String regExStr, String str); String normalizeEmail(String email); String[] split(String value); String[] split(String value, String delimiter); static String trim(String str); boolean isValidName(String name); boolean isEmpty(List<?> list); String getValidUserName(String str); static final public int MIN_PASSWORD_LENGTH; static final public String VALIDATION_NAME; static final public String VALIDATION_TEXT; static final public String VALIDATION_LOGINID; static final public String VALIDATION_ALPHA; static final public String VALIDATION_IP_ADDRESS; static final public String WILDCARD_ASTERISK; }