List of utility methods to do String Starts Wtih
boolean | startsWith(String str, String prefix)StringUtilities.startsWith(null, null) = true StringUtilities.startsWith(null, "abc") = false StringUtilities.startsWith("abcdef", null) = false StringUtilities.startsWith("abcdef", "abc") = true StringUtilities.startsWith("ABCDEF", "abc") = false return startsWith(str, prefix, false);
|
boolean | StartsWith(String str, String prefix) Starts With if (str == null) { throw new NullPointerException("str"); if (prefix == null) { throw new NullPointerException("prefix"); return (prefix.length() >= str.length()) && str.substring(0, prefix.length()).equals(prefix); |
boolean | startsWith(String str, String prefix, boolean ignoreCase) starts With if (str == null || prefix == null) { return (str == null && prefix == null); if (prefix.length() > str.length()) { return false; return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length()); |
boolean | startsWith(String str, String prefix, boolean ignoreCase) Check if a String starts with a specified prefix (optionally case insensitive). if (str == null || prefix == null) { return (str == null && prefix == null); return prefix.length() <= str.length() && str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length()); |
boolean | startsWith(String str, String prefix, int index) starts With if (str == null || prefix == null || index < 0 || index >= str.length()) throw new IllegalArgumentException(); int endpos = prefix.length() + index; if (endpos > str.length()) return false; return str.substring(index, endpos).equals(prefix); |
boolean | startsWith(String str, String start, boolean caseSensitive) starts With if (str == null || start == null) { return (str == null && start == null); if (start.length() > str.length()) { return false; return str.regionMatches(caseSensitive, 0, start, 0, start.length()); |
boolean | startsWith(String str1Raw, String str2Raw) starts With String str1 = str1Raw.toLowerCase(); String str2 = str2Raw.toLowerCase(); for (int i = 0; i < str1.length() && i < str2.length(); i++) { if (str1.charAt(i) != str2.charAt(i)) { return false; return true; ... |
boolean | startsWith(String string, char... ca) starts With int l = ca.length; for (int i = 0; i < l; i++) { if (string.charAt(i) != ca[i]) return false; return true; |
boolean | startsWith(String string, String prefix) Indicate if the given string starts with the given prefix. return string.regionMatches(true, 0, prefix, 0, prefix.length());
|
boolean | startsWith(String string, StringBuffer prefix, int toffset) starts With return regionMatches(string, toffset, prefix, 0, prefix.length());
|