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 haystack, String pattern)
starts With Ignore Case
return haystack.substring(0, pattern.length()).equalsIgnoreCase(pattern);
booleanstartsWithIgnoreCase(String input, String prefix)
Tests if this string starts with the specified prefix, ignoring case
if (input == null || prefix == null || prefix.length() > input.length()) {
    return false;
} else {
    for (int i = 0; i < prefix.length(); i++) {
        if (!equalsIgnoreCase(prefix.charAt(i), input.charAt(i))) {
            return false;
    return true;
booleanstartsWithIgnoreCase(String inputValue, String prefix)
Tests if this string starts with the specified prefix, ignoring the case sensitive.
return inputValue.regionMatches(true, 0, prefix, 0, prefix.length());
booleanstartsWithIgnoreCase(String main, String with)
Method to determine if one string is a subset of another, but case-insensitive.
int mainLen = main.length();
int withLen = with.length();
if (withLen > mainLen)
    return false;
for (int i = 0; i < withLen; i++) {
    char mainChr = Character.toLowerCase(main.charAt(i));
    char withChr = Character.toLowerCase(with.charAt(i));
    if (mainChr != withChr)
...
booleanstartsWithIgnoreCase(String name, Iterable patterns)
Does the given column name starts with one of pattern given in parameter Not case sensitive
String nameUpper = name.toUpperCase();
for (String pattern : patterns) {
    String patternUpper = pattern.toUpperCase();
    if (nameUpper.equals(patternUpper) || nameUpper.startsWith(patternUpper)) {
        return true;
return false;
...
booleanstartsWithIgnoreCase(String originalString, String checkPhrase)
Check if a string starts with another phrase, case-ignored
if (originalString == null || checkPhrase == null) {
    return false;
return originalString.toLowerCase().startsWith(checkPhrase.toLowerCase());
booleanstartsWithIgnoreCase(String p_sStr, String p_sSubStr)
Same as String#startsWith(String) , but ignoring case
if (p_sSubStr.length() > p_sStr.length())
    return false;
for (int i = 0; i < p_sSubStr.length(); i++) {
    char cSubStr = p_sSubStr.charAt(i);
    char cStr = p_sStr.charAt(i);
    char cSubStrLC = Character.toLowerCase(cSubStr);
    char cStrLC = Character.toLowerCase(cStr);
    if (cSubStrLC != cStrLC)
...
booleanstartsWithIgnoreCase(String s, int offset, int end, String lowerCase)
True if the lower-case version of s[off:end] starts with the given lower-case string.
int n = lowerCase.length();
if (end - offset < n) {
    return false;
int off = offset;
for (int i = 0; i < n; ++off, ++i) {
    if (lcase(s.charAt(off)) != lowerCase.charAt(i)) {
        return false;
...
booleanstartsWithIgnoreCase(String s, String prefix)
starts With Ignore Case
int length = prefix.length();
if (s.length() < length)
    return false;
for (int i = 0; i < length; i++) {
    char c1 = s.charAt(i);
    char c2 = prefix.charAt(i);
    if (c1 == c2)
        continue;
...
booleanstartsWithIgnoreCase(String s, String prefix)
Identical to String.startsWith but case insensitive.
return startsWithIgnoreCase(s, prefix, 0);