Here you can find the source of endsWithIgnoreCase(String p_sStr, String p_sSubStr)
Parameter | Description |
---|---|
p_sStr | string value |
p_sSubStr | sub string |
public static boolean endsWithIgnoreCase(String p_sStr, String p_sSubStr)
//package com.java2s; //License from project: Apache License public class Main { /**/*from ww w .j av a 2 s. c om*/ * Same as {@link String#endsWith(String)}, but ignoring case * * @param p_sStr string value * @param p_sSubStr sub string * @return true, if substring */ public static boolean endsWithIgnoreCase(String p_sStr, String p_sSubStr) { if (p_sSubStr.length() > p_sStr.length()) return false; int nSubStrLen = p_sSubStr.length(); int nStrLen = p_sStr.length(); int nIdx = 1; for (int i = nSubStrLen - 1; i >= 0; i--) { char cSubStr = p_sSubStr.charAt(i); char cStr = p_sStr.charAt(nStrLen - nIdx); char cSubStrLC = Character.toLowerCase(cSubStr); char cStrLC = Character.toLowerCase(cStr); if (cSubStrLC != cStrLC) return false; nIdx++; } return true; } }