Here you can find the source of startsWith(String receiver, String... needles)
public static boolean startsWith(String receiver, String... needles)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean startsWith(String receiver, String... needles) { return startsWith(receiver, false, needles); }/*w ww .ja v a 2 s . co m*/ public static boolean startsWith(String receiver, boolean ignoreCase, String... needles) { if (receiver == null) return false; for (String needle : needles) { if (startsWith(receiver, ignoreCase, needle)) { return true; } } return false; } public static boolean startsWith(CharSequence receiver, String prefix, boolean ignoreCase) { return receiver.length() >= prefix.length() && regionMatches(receiver, 0, prefix, 0, prefix.length(), ignoreCase); } public static boolean regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase) { if (ignoreCase) { for (int i = 0; i < length; i++) { if (Character.toLowerCase(receiver.charAt(i + thisOffset)) != Character .toLowerCase(other.charAt(i + otherOffset))) return false; } } else { for (int i = 0; i < length; i++) { if (receiver.charAt(i + thisOffset) != other.charAt(i + otherOffset)) return false; } } return true; } }