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(String target, String... prefixes)
Returns whether the given target string starts with one of the given prefixes.
for (String prefix : prefixes)
    if (target.startsWith(prefix))
        return true;
return false;
booleanstartsWith(String text, String prefix, int toffset)
starts With
int po = 0;
int pc = prefix.length();
if (toffset < 0 || pc > text.length())
    return false;
char ta[] = text.toCharArray();
int to = toffset;
char pa[] = prefix.toCharArray();
while (--pc >= 0) {
...
booleanstartsWith(String toTest, String[] possibilities)
Tests whether the given string starts with one of the strings in the array
for (String p : possibilities) {
    if (toTest.startsWith(p)) {
        return true;
return false;
booleanstartsWith(String value, String startsWith)
Checks if value starts with startsWith.
if ((value == null) || (startsWith == null)) {
    return false;
return value.startsWith(startsWith);
booleanstartsWith(String[] array, String obj)
starts With
for (String element : array) {
    if (element.startsWith(obj)) {
        return true;
return false;
booleanstartsWith(String[] beginningSegments, String[] testSegments)
starts With
for (int i = 0; i < beginningSegments.length; i++) {
    if (!beginningSegments[i].equals(testSegments[i]))
        return false;
return true;
intstartsWith(String[] searchStrings, String text)
Returns the index of the longest search string with which the given text starts or -1 if none matches.
int index = -1;
for (int i = 0; i < searchStrings.length; i++) {
    if (text.startsWith(searchStrings[i])) {
        if (index == -1 || searchStrings[i].length() > searchStrings[index].length())
            index = i;
return index;
...
booleanstartsWith(String[] target, String[] with)
starts With
if (with.length > target.length)
    return false;
for (int i = 0; i < with.length; i++)
    if (!with[i].equals(target[i]))
        return false;
return true;
booleanstartsWith(StringBuffer buffer, String prefix)
Does the buffer start with prefix?
boolean startsWith = buffer.indexOf(prefix) == 0;
return startsWith;
booleanstartsWith(StringBuilder builder, String prefix, int offset)
Does the builder start with prefix?
int i = builder.indexOf(prefix, offset);
boolean startsWith = i == offset;
return startsWith;