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

booleanstartsWith(StringBuilder sb, String prefix)
Tests if this string starts with the specified prefix.
return startsWith(sb, prefix, 0);
booleanstartsWith(T[] arr, T[] prefix)
Tests if the array starts with another prefix array.
if (arr.length < prefix.length)
    return false;
for (int i = 0; i < prefix.length; i++) {
    if (!arr[i].equals(prefix[i]))
        return false;
return true;
booleanstartsWith4(String string, int startIndex, int char1, int char2, int char3, int char4)
Return true if the four-character substring occurs at the given index in the given string.
return string.length() - startIndex >= 4 && string.charAt(startIndex) == char1
        && string.charAt(startIndex + 1) == char2 && string.charAt(startIndex + 2) == char3
        && string.charAt(startIndex + 3) == char4;
booleanstartsWithAcronym(String word)
starts With Acronym
return word.length() >= 2 && Character.isUpperCase(word.charAt(0)) && Character.isUpperCase(word.charAt(1))
        && word.matches(ALPHANUMERIC_REGEX);
booleanstartsWithAndHasMore(String input, String toStartWith)
Returns true iff input String#startsWith(String) starts with toStartWith and has more characters after that match
return input.startsWith(toStartWith) && input.length() > toStartWith.length();
booleanstartsWithAny(String _str, String... _startStrings)
Checks if given String starts with any of the other given parameters.
if (_str == null || _startStrings == null || _startStrings.length == 0) {
    return false;
for (String start : _startStrings) {
    if (_str.startsWith(start)) {
        return true;
return false;
booleanstartsWithAny(String s, String... options)
Checks whether the given String starts with any of the given options.
return indexOfStartsWithAny(s, options) != -1;
booleanstartsWithAny(String source, String[] checks)
Returns true if source contains any of the Strings held in checks.
for (String s : checks) {
    if (source.toLowerCase().startsWith(s.toLowerCase()))
        return true;
return false;
booleanstartsWithAny(String str, String... args)
starts With Any
if (str != null) {
    for (String s : args) {
        if (str.startsWith(s)) {
            return true;
return false;
...
booleanstartsWithAny(String stringToMatch, String... stringToCheckEquals)
starts With Any
for (final String candidate : stringToCheckEquals) {
    if (stringToMatch.startsWith(candidate)) {
        return true;
return false;