Java Utililty Methods String Start With

List of utility methods to do String Start With

  1. HOME
  2. Java
  3. S
  4. String Start With

Description

The list of methods to do String Start With are organized into topic(s).

Method

boolean startWith(String source, String target)
start With
if (source.length() < target.length()) {
 return false;
String sub = source.substring(0, target.length());
return target.equalsIgnoreCase(sub);
boolean startWith(String str, String prefix)
start With
return str.startsWith(prefix);
boolean startWith(String str, String start)
NullPoint safe.
if (str == null)
 return false;
return str.startsWith(start);
String startWith(String string, String prefix)
start With
if (empty(string)) {
 return prefix;
} else if (string.startsWith(prefix)) {
 return string;
} else {
 return prefix + string;
Boolean startWith(String string1, String string2)
Indicates if the string 1 starts with string2.
return (string1 != null) ? string1.startsWith(string2) : false;
String startWithAorAn(String str)
start With Aor An
if (str.length() == 0)
 return str;
if ((!str.toUpperCase().startsWith("A ")) && (!str.toUpperCase().startsWith("AN "))
 && (!str.toUpperCase().startsWith("THE ")) && (!str.toUpperCase().startsWith("SOME "))) {
 if ("aeiouAEIOU".indexOf(str.charAt(0)) >= 0)
 return "an " + str;
 return "a " + str;
return str;
boolean startWithBOM(byte[] array)
Test if the byte array starts with BOM.
if (array.length < 3) {
 return false;
if ((array[0] != (byte) 0xEF) || (array[1] != (byte) 0xBB) || (array[2] != (byte) 0xBF)) {
 return false;
return true;
boolean startWithIgnoreCase(CharSequence str, CharSequence prefix)
start With Ignore Case
return startWith(str, prefix, true);
boolean startWithIgnoreCase(String str, String prefix)
start With Ignore Case
if (str.length() < prefix.length())
 return false;
return prefix.equalsIgnoreCase(str.substring(0, prefix.length()));
String startWithLowerCase(String in)
start With Lower Case
return in.substring(0, 1).toLowerCase() + in.substring(1);


AltStyle によって変換されたページ (->オリジナル) /