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 s, String prefix)
Returns true iff s starts with prefix, ignoring case.
final int pl = prefix.length();
if (s.length() < pl)
    return false;
for (int i = 0; i < pl; i++) {
    char sc = s.charAt(i);
    char pc = prefix.charAt(i);
    if (sc != pc) {
        sc = Character.toUpperCase(sc);
...
booleanstartsWithIgnoreCase(String s, String start)
Check is a string starts with another string, ignoring the case.
if (s.length() < start.length()) {
    return false;
return s.substring(0, start.length()).equalsIgnoreCase(start);
booleanstartsWithIgnoreCase(String s, String w)
starts With Ignore Case
if (w == null)
    return true;
if (s == null || s.length() < w.length())
    return false;
for (int i = 0; i < w.length(); i++) {
    char c1 = s.charAt(i);
    char c2 = w.charAt(i);
    if (c1 != c2) {
...
booleanstartsWithIgnoreCase(String searchIn, int startAt, String searchFor)
starts With Ignore Case
return searchIn.regionMatches(true, startAt, searchFor, 0, searchFor.length());
booleanstartsWithIgnoreCase(String searchIn, int startAt, String searchFor)
Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case starting at 'startAt' Shorthand for a String.regionMatch(...)
return searchIn.regionMatches(true, startAt, searchFor, 0, searchFor.length());
booleanstartsWithIgnoreCase(String searchIn, String searchFor)
 Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case. 
return startsWithIgnoreCase(searchIn, 0, searchFor);
booleanstartsWithIgnoreCase(String seq, String prefix)
Tests if the string sequence starts with the specified prefix, case insensitive.
return seq.toLowerCase().startsWith(prefix.toLowerCase());
booleanstartsWithIgnoreCase(String startString, String anotherString)
check whether a string starts with anotherString (ignore case)
int length = startString.length();
if (length > anotherString.length()) {
    return false;
if (startString.equalsIgnoreCase(anotherString.substring(0, length))) {
    return true;
} else {
    return false;
...
booleanstartsWithIgnoreCase(String str, String prefix)
starts With Ignore Case
if (str == null || prefix == null) {
    return false;
final int len = prefix.length();
if (str.length() < len) {
    return false;
return str.regionMatches(true, 0, prefix, 0, len);
...
booleanstartsWithIgnoreCase(String str, String prefix)

Case insensitive check if a String starts with a specified prefix.

nulls are handled without exceptions.

return startsWith(str, prefix, true);