Here you can find the source of startsWith(String s, int offset, int end, String t)
static boolean startsWith(String s, int offset, int end, String t)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { /** True iff s[off:end] starts with t. */ static boolean startsWith(String s, int offset, int end, String t) { int n = t.length(); if (end - offset < n) { return false; }//w w w . j a v a2 s . com int off = offset; for (int i = 0; i < n; ++off, ++i) { if (s.charAt(off) != t.charAt(i)) { return false; } } return true; } /** True iff s[off:end] starts with t. */ static boolean startsWith(char[] s, int offset, int end, String t) { int n = t.length(); if (end - offset < n) { return false; } int off = offset; for (int i = 0; i < n; ++off, ++i) { if (s[off] != t.charAt(i)) { return false; } } return true; } static char charAt(char[] s, int i) { return s[i]; } }