Java Utililty Methods String Lower Case

List of utility methods to do String Lower Case

Description

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

Method

StringtoLowerCaseInitial(String srcString, boolean flag)
to Lower Case Initial
StringBuilder sb = new StringBuilder();
if (flag) {
    sb.append(Character.toLowerCase(srcString.charAt(0)));
} else {
    sb.append(Character.toUpperCase(srcString.charAt(0)));
sb.append(srcString.substring(1));
return sb.toString();
...
StringtoLowerCaseSafe(String str)
to Lower Case Safe
return str == null ? null : str.toLowerCase();
StringtoLowercaseSlug(String string)
Transforms a string into its slug version.
String sluggedString = String.join("-", string.split("(?=[A-Z])"));
return sluggedString.toLowerCase();
StringtoLowerCaseSubsystemType(String s)
to Lower Case Subsystem Type
if (s == null) {
    return null;
if (s.equalsIgnoreCase("CA")) {
    return "ca";
} else if (s.equalsIgnoreCase("KRA")) {
    return "kra";
} else if (s.equalsIgnoreCase("OCSP")) {
...
StringtoLowercaseWithDashes(String text)
Conver to lowercase with dashes from upper camelcase.
char[] chars = text.toCharArray();
StringBuilder sb = new StringBuilder();
boolean isFirst = true;
for (char c : chars) {
    if (isFirst) {
        sb.append(Character.toLowerCase(c));
        isFirst = false;
        continue;
...
StringtoLowerCaseWithSepStyle(String string, String separator)

Converts compound names to the "lower case with separtor style".

char[] chars = string.toCharArray();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < chars.length; i++) {
    if (Character.isUpperCase(chars[i]) && 
            i > 0 && 
            (Character.isLowerCase(chars[i - 1])
                    || (i < chars.length - 1 && Character.isLowerCase(chars[i + 1]))))
        buffer.append(separator);
...
StringtoLowerCaseWithUnderscores(String className)
to Lower Case With Underscores
StringBuilder sb = new StringBuilder();
for (char c : className.toCharArray()) {
    if (c >= 'A' && c <= 'Z' && sb.length() > 0) {
        sb.append('_');
    sb.append(Character.toLowerCase(c));
return sb.toString();
...
StringtoLowerCaseWithUnderscores(String str)
to Lower Case With Underscores
return null;