List of utility methods to do String Starts Wtih
boolean | startsWithCS(String a, String b) starts With CS return a == null || b == null ? false : a.startsWith(b);
|
boolean | startsWithDigitsFollowedByLetters(String str) Checks whether a string starts with digits and might contains after the digits only letters int strLen = str.length(); boolean startsWithDigits = false; int startForLetters = 0; for (int i = 0; i < strLen; i++) { if (Character.isDigit(str.charAt(i))) { startsWithDigits = true; continue; startForLetters = i; break; boolean followedByLetters = true; if (startsWithDigits && startForLetters > 0) { for (int i = startForLetters; i < strLen; i++) { if (!Character.isLetter(str.charAt(i))) { followedByLetters = false; break; return startsWithDigits && followedByLetters; |
boolean | startsWithHtml(Object object) starts With Html if (object instanceof CharSequence) { return startsWithHtml((CharSequence) object); } else if (object != null) { return startsWithHtml(object.toString()); return false; |
boolean | startsWithIC(String s1, String... strings) Returns whether s1 starts with any of the given strings, ignoring case. for (String string : strings) if (startsWithIC(s1, string)) return true; return false; |
boolean | startsWithIgnoreCase(final String base, final String start) Helper functions to query a strings start portion. if (base.length() < start.length()) { return false; return base.regionMatches(true, 0, start, 0, start.length()); |
boolean | startsWithIgnoreCase(final String haystack, final String needle) Does a string start with a second string ignoring case? return needle.equalsIgnoreCase(haystack.substring(0, needle.length()));
|
boolean | startsWithIgnoreCase(final String iFirst, final String iSecond) starts With Ignore Case if (iFirst == null) throw new IllegalArgumentException("Origin string to compare is null"); if (iSecond == null) throw new IllegalArgumentException("String to match is null"); final int iSecondLength = iSecond.length(); if (iSecondLength > iFirst.length()) return false; for (int i = 0; i < iSecondLength; ++i) { ... |
boolean | startsWithIgnoreCase(final String input, final String prefix) Checks if a string starts with a given suffix. if (input == null) throw new IllegalArgumentException("Input cannot be null!"); if (prefix == null) throw new IllegalArgumentException("Suffix cannot be null!"); return input.startsWith(prefix) || input.length() >= prefix.length() && input.toLowerCase().startsWith(prefix.toLowerCase()); |
boolean | startsWithIgnoreCase(final String source, final String target) Returns true if given source string start with target string ignore case sensitive; false otherwise. if (source.startsWith(target)) { return true; if (source.length() < target.length()) { return false; return source.substring(0, target.length()).equalsIgnoreCase(target); |
boolean | startsWithIgnoreCase(final String str, final String prefix) starts With Ignore Case return startsWith(str, prefix, true);
|