List of utility methods to do String Starts Wtih
boolean | startsWith(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; |
boolean | startsWith(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) { ... |
boolean | startsWith(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; |
boolean | startsWith(String value, String startsWith) Checks if value starts with startsWith .
if ((value == null) || (startsWith == null)) { return false; return value.startsWith(startsWith); |
boolean | startsWith(String[] array, String obj) starts With for (String element : array) { if (element.startsWith(obj)) { return true; return false; |
boolean | startsWith(String[] beginningSegments, String[] testSegments) starts With for (int i = 0; i < beginningSegments.length; i++) { if (!beginningSegments[i].equals(testSegments[i])) return false; return true; |
int | startsWith(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; ... |
boolean | startsWith(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; |
boolean | startsWith(StringBuffer buffer, String prefix) Does the buffer start with prefix? boolean startsWith = buffer.indexOf(prefix) == 0; return startsWith; |
boolean | startsWith(StringBuilder builder, String prefix, int offset) Does the builder start with prefix? int i = builder.indexOf(prefix, offset); boolean startsWith = i == offset; return startsWith; |