Here you can find the source of endsWithIgnoreCase(final String str, final String end)
public static final boolean endsWithIgnoreCase(final String str, final String end)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from ww w . j a v a2 s. com * IBM Corporation - initial API and implementation *******************************************************************************/ public class Main { /** * Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) * implementation is not creating extra strings. */ public static final boolean endsWithIgnoreCase(final String str, final String end) { if (str == null && end == null) { return true; } if (str == null) { return false; } if (end == null) { return false; } if (str.equals(end)) { return true; } final int strLength = str.length(); final int endLength = end.length(); // return false if the string is smaller than the end. if (endLength > strLength) { return false; } // return false if any character of the end are // not the same in lower case. for (int i = 1; i <= endLength; i++) { if (Character.toLowerCase(end.charAt(endLength - i)) != Character .toLowerCase(str.charAt(strLength - i))) { return false; } } return true; } }