Here you can find the source of startsWith(String s, String prefix)
public static boolean startsWith(String s, String prefix)
//package com.java2s; //License from project: Apache License public class Main { public static boolean startsWith(String s, String prefix) { if (s == null) { return false; }//from w ww. j a v a2 s. c o m for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { continue; } else { return s.regionMatches(i, prefix, 0, prefix.length()); } } return false; } }