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(final String str, final String... prefixes)
Nullpointer save version of String.startsWith.
if (str == null || prefixes == null) {
    return false;
for (final String prefix : prefixes) {
    if (str.startsWith(prefix) == true) {
        return true;
return false;
booleanstartsWith(String baseString, String compareString)
startWith
if (baseString == null || compareString == null)
    return false;
else
    return baseString.startsWith(compareString);
booleanstartsWith(String check, String doesStartWith)
starts With
return check.startsWith(doesStartWith);
booleanstartsWith(String cid1, String cid2)
Check if cid1 starts with cid2.
if (cid1 == null && cid2 == null) {
    return true;
if (cid1 == null || cid2 == null) {
    return false;
if (cid1.startsWith(cid2) && cid1.charAt(cid2.length()) == '.') {
    return true;
...
booleanstartsWith(String comparee, char comparant)
starts With
if (comparee.length() == 0)
    return false;
return comparee.charAt(0) == comparant;
booleanstartsWith(String inStart, String inValue)
NPE safe String startsWith
if (inStart == null && inValue == null) {
    return true;
} else if (inStart == null || inValue == null) {
    return false;
return inValue.startsWith(inStart);
booleanstartsWith(String n, char tag)
starts With
return n.charAt(0) == tag;
booleanstartsWith(String partial, String possible)
starts With
return possible.regionMatches(true, 0, partial, 0, partial.length());
booleanstartsWith(String path, String prefix)
Parts based comparison to make sure that whole parts from path match whole parts from the prefix.
String[] pathParts = path.split("\\/");
String[] prefixParts = prefix.split("\\/");
if (pathParts.length < prefixParts.length)
    return false;
for (int i = 0; i < prefixParts.length; i++) {
    String pathPart = pathParts[i];
    String prefixPart = prefixParts[i];
    if (!pathPart.equals(prefixPart))
...
booleanstartsWith(String prefix, String string, boolean caseInsensitive)
Check that string starts with specified prefix.
if (caseInsensitive) {
    int prefixLength = prefix.length();
    if (string.length() < prefixLength) {
        return false;
    return prefix.equals(string.substring(0, prefixLength).toLowerCase());
} else {
    return string.startsWith(prefix);
...