Java Utililty Methods String Starts Wtih

List of utility methods to do String Starts Wtih

Description

The list of methods to do String Starts Wtih are organized into topic(s).

Method

booleanstartsWithOneOf(String string, String... prefixes)
Returns true if the given string starts with one of the given prefixes.
for (String prefix : prefixes) {
    if (string.startsWith(prefix)) {
        return true;
return false;
booleanstartsWithOrMatches(String s1, String s2)
Combination of startsWith and matches string comparison.
if (s1 == null) {
    return s2 == null;
if (s2 == null) {
    return false;
return s1.startsWith(s2) || s1.matches(s2);
StringstartsWithPattern(String value, String matchingPatterns)
starts With Pattern
return startsWithPattern(value, matchingPatterns, ",");
booleanstartsWithPhraseSeparator(char[] token)
Check if token starts with a phrase separator
return token.length > 0 && isPhraseSeparator(token[0]);
booleanstartsWithPrefix(final String methodName, final String prefix, final int prefixLength)
starts With Prefix
return (((methodName.length() > prefixLength) && methodName.startsWith(prefix))
        && Character.isUpperCase(methodName.charAt(prefixLength)));
booleanstartsWithPrefix(String inputText, String[] prefixes)
starts With Prefix
for (int i = 0; i < prefixes.length; i++) {
    if (inputText.startsWith(prefixes[i])) {
        return true;
return false;
booleanstartsWithQuote(String str)
Gets whether string starts with quote.
if (str.length() == 0) {
    return false;
return str.trim().charAt(0) == '"';
booleanstartsWithSeparator(String str)
starts With Separator
return str != null && (str.startsWith("/") || str.startsWith("\\"));
booleanstartsWithSeveralUpperCaseLetters(String string)
starts With Several Upper Case Letters
return string.length() > 1 && Character.isUpperCase(string.charAt(0))
        && Character.isUpperCase(string.charAt(1));
booleanstartsWithSlash(String path)
starts With Slash
return path.charAt(0) == '/';