List of utility methods to do String Start With
String | startWithLowerCase(String methodName) start With Lower Case if (methodName.length() > 1 && Character.isUpperCase(methodName.charAt(1))) return methodName; char firstChar = Character.toLowerCase(methodName.charAt(0)); return firstChar + methodName.substring(1); |
boolean | startWithProtocol(String input) Checks if the given string matches some of the protocols suported by this method. boolean ret = false; if (input != null) { input = input.toLowerCase(); for (int i = 0; i < protocols.length; i++) { if (input.startsWith(protocols[i])) { ret = true; break; return ret; |
boolean | startWithProtocol(String input) Check if the provided String start with one supported protocol strings. if (input != null) { input = input.toLowerCase(); for (String protocol : PROTOCOLS) { if (input.startsWith(protocol)) { return true; return false; |
boolean | startWithRoot(String path) Checks if the provide path starts with a valid root, such as "/" or "C:". return startsWithLinuxRoot(path) || startWithWindowsRoot(path);
|
String | startWithUppercase(String name) start With Uppercase if (name == null) throw new NullPointerException(); if (name.isEmpty()) return name; return name.substring(0, 1).toUpperCase() + name.substring(1); |
String | startWithUppercase(String text) start With Uppercase if (text.length() > 2) { return Character.toUpperCase(text.charAt(0)) + text.substring(1); } else { return text; |
boolean | startWithWindowsRoot(String path) Checks if the provide path starts with a valid Windows root, for example "C:". return path != null && path.length() >= 2 && path.charAt(1) == ':' && Character.isLetter(path.charAt(0)); |