add unCamelCaseKeepCapitals

This commit is contained in:
Grahame Grieve 2023-02-09 17:39:47 +11:00
parent 97604fdff5
commit e6548bcccd
1 changed files with 20 additions and 1 deletions

View File

@ -1181,6 +1181,20 @@ public class Utilities {
return fn.contains(".") ? fn.substring(fn.lastIndexOf(".") + 1) : "";
}
public static String unCamelCaseKeepCapitals(String name) {
StringBuilder b = new StringBuilder();
boolean first = true;
for (char c : name.toCharArray()) {
if (Character.isUpperCase(c)) {
if (!first)
b.append(" ");
b.append(c);
} else
b.append(c);
first = false;
}
return b.toString();
}
public static String unCamelCase(String name) {
StringBuilder b = new StringBuilder();
@ -1862,4 +1876,9 @@ public class Utilities {
}
}
public static boolean isValidCRName(String name) {
return name != null && name.matches("[A-Z]([A-Za-z0-9_]){1,254}");
}
}