Here you can find the source of startsWith(String text, String prefix, int toffset)
public static boolean startsWith(String text, String prefix, int toffset)
//package com.java2s; /*************************************************************************** * Copyright 2001-2006 VietSpider All rights reserved. * * Please look at license.txt in info directory for more license detail. * **************************************************************************/ public class Main { public static boolean startsWith(String text, String prefix, int toffset) { int po = 0; int pc = prefix.length(); if (toffset < 0 || pc > text.length()) return false; char ta[] = text.toCharArray(); int to = toffset; char pa[] = prefix.toCharArray(); while (--pc >= 0) { char c1 = ta[to++]; char c2 = pa[po++]; if (c1 == c2 || Character.toLowerCase(c1) == Character .toLowerCase(c2)) continue; return false; }// w w w .j ava 2 s. c o m return true; } }