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

booleanstartsWithIgnoreCase(String str, String prefix)
Checks if the given String begins with the given prefix, ignoring case.
if (str == null)
    throw new IllegalArgumentException("Parameter 'str' cannot be null!");
if (prefix == null)
    throw new IllegalArgumentException("Parameter 'prefix' cannot be null!");
if (str.length() < prefix.length())
    return false;
int offset = (prefix.length() + 1 <= str.length()) ? prefix.length() : str.length();
String beginning = str.substring(0, offset);
...
booleanstartsWithIgnoreCase(String str, String prefix)
Test if the given String starts with the specified prefix, ignoring upper/lower case.
return (str != null && prefix != null && str.length() >= prefix.length()
        && str.regionMatches(true, 0, prefix, 0, prefix.length()));
booleanstartsWithIgnoreCase(String str, String prefix)
Test if the given String starts with the specified prefix, ignoring upper/lower case.
if (str == null || prefix == null) {
    return false;
if (str.startsWith(prefix)) {
    return true;
if (str.length() < prefix.length()) {
    return false;
...
booleanstartsWithIgnoreCase(String str, String prefix)
starts With Ignore Case
return startsWith(str, prefix, true);
booleanstartsWithIgnoreCase(String str, String start)
Returns whether str starts with start, ignoring case.
int startLen = start.length();
if (str.length() >= startLen) {
    for (int i = 0; i < startLen; i++) {
        char c1 = str.charAt(i);
        char c2 = start.charAt(i);
        if (Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
            return false;
    return true;
return false;
booleanstartsWithIgnoreCase(String str1, String str2)
starts With Ignore Case
if (str1.length() >= str2.length()) {
    return (str1.regionMatches(true, 0, str2, 0, str2.length()));
} else {
    return (false);
booleanstartsWithIgnoreCase(String string1, String string2)
starts With Ignore Case
if (string1 == null || string2 == null)
    return false;
int len = string2.length();
if (string1.length() < len)
    return false;
String test = string1.substring(0, len);
return test.equalsIgnoreCase(string2);
booleanstartsWithIgnoreCase(String text, String prefix)
starts With Ignore Case
if (text == null)
    return (prefix == null);
if (prefix == null)
    return false;
return text.toLowerCase().startsWith(prefix.toLowerCase());
booleanstartsWithIgnoreCase(String text, String value)
starts With Ignore Case
return text.toLowerCase().startsWith(value.toLowerCase());
booleanstartsWithIgnoreCase(String thisString, String prefix)
starts With Ignore Case
String temp = thisString.substring(0, Math.min(prefix.length(), thisString.length()));
return temp.equalsIgnoreCase(prefix);