Android examples for java.lang:String Starts or Ends
is String Start With one of the string in the array
import android.text.TextUtils; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static boolean isStartWith(String str, String[] containsStr) { boolean isStartWith = false; for (String strItem : containsStr) { Pattern p = Pattern.compile(strItem + "(.*?)"); Matcher m = p.matcher(str); while (m.find()) { String first = m.group(0); String second = str.replaceAll(first, ""); isStartWith = true;//www. j a v a2 s . c o m return isStartWith; } } return isStartWith; } }