Here you can find the source of EndsWith(String str, String suffix, int strStartPos)
public static boolean EndsWith(String str, String suffix, int strStartPos)
//package com.java2s; public class Main { public static boolean EndsWith(String str, String suffix, int strStartPos) { if (str == null) { throw new NullPointerException("str"); }//from ww w . j a v a2s .c o m if (suffix == null) { throw new NullPointerException("suffix"); } if (strStartPos < 0) { throw new IllegalArgumentException("strStartPos (" + strStartPos + ") is less than " + "0"); } if (strStartPos > str.length()) { throw new IllegalArgumentException("strStartPos (" + strStartPos + ") is more than " + str.length()); } int endpos = suffix.length() + strStartPos; return (endpos <= str.length()) && str.substring(strStartPos, (strStartPos) + (endpos - strStartPos)).equals(suffix); } }