List of utility methods to do String Starts Wtih
boolean | startsWithChar(CharSequence s, char prefix) starts With Char return s != null && s.length() != 0 && s.charAt(0) == prefix;
|
boolean | startsWithChar(final String s, final char c) starts With Char if (s == null || s.length() == 0) { return false; return s.charAt(0) == c; |
boolean | startsWithChar(String s, char c) starts With Char if (s.length() == 0) { return false; return s.charAt(0) == c; |
boolean | startsWithChar(String string, char prefix) Tests if this string starts with the specified prefix. return string.length() > 0 && string.charAt(0) == prefix;
|
boolean | startsWithChar(String string, int character) Return true if the given string starts with the given character. return string.length() > 0 && string.charAt(0) == character;
|
boolean | startsWithCharacter(String str, char stringStart) Checks if the string str starts with the given character return str.length() > 0 && str.charAt(0) == stringStart;
|
boolean | startsWithCharacter(String str, String matchChars) Check for defined Characters at start of Word or Sequence of words for (int i = 0; i < str.length(); i++) { final char ch = str.charAt(i); final int index = matchChars.indexOf(ch); if (index != -1) { return true; } else { return false; return false; |
boolean | startsWithCommonPackagePrefix(String inputText) starts With Common Package Prefix return startsWithPrefix(inputText, new String[] { "java.", "javax.", "com.", "net.", "org." }); |
boolean | startsWithConcatenation(String string, String... prefixes) Equivalent to string.startsWith(prefixes[0] + prefixes[1] + ...) but avoids creating an object for concatenation. int offset = 0; for (String prefix : prefixes) { int prefixLen = prefix.length(); if (!string.regionMatches(offset, prefix, 0, prefixLen)) { return false; offset += prefixLen; return true; |
boolean | startsWithConcatenationOf(String testee, String firstPrefix, String secondPrefix) Equivalent to testee.startsWith(firstPrefix + secondPrefix) but avoids creating an object for concatenation. int l1 = firstPrefix.length(); int l2 = secondPrefix.length(); if (testee.length() < l1 + l2) return false; return testee.startsWith(firstPrefix) && testee.regionMatches(l1, secondPrefix, 0, l2); |