Here you can find the source of lastIndexOfIgnoreCase(final String s, final String subS)
public static int lastIndexOfIgnoreCase(final String s, final String subS)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static int lastIndexOfIgnoreCase(final String s, final String subS) { return lastIndexOfIgnoreCase(s, subS, s.length(), 0); }//from w ww .java 2s . co m public static int lastIndexOfIgnoreCase(final String src, final String subS, final int startIndex) { return lastIndexOfIgnoreCase(src, subS, startIndex, 0); } public static int lastIndexOfIgnoreCase(final String src, String sub, int startIndex, int endIndex) { final int sublen = sub.length(); final int srclen = src.length(); if (sublen == 0) { return (startIndex > srclen) ? srclen : ((startIndex < -1) ? -1 : startIndex); } sub = sub.toLowerCase(); final int total = srclen - sublen; if (total < 0) { return -1; } if (startIndex >= total) { startIndex = total; } if (endIndex < 0) { endIndex = 0; } final char c = sub.charAt(0); Label_0159: for (int i = startIndex; i >= endIndex; --i) { if (Character.toLowerCase(src.charAt(i)) == c) { for (int j = 1, k = i + 1; j < sublen; ++j, ++k) { final char source = Character.toLowerCase(src.charAt(k)); if (sub.charAt(j) != source) { continue Label_0159; } } return i; } } return -1; } public static int lastIndexOfIgnoreCase(final String src, char c, int startIndex, int endIndex) { final int total = src.length() - 1; if (total < 0) { return -1; } if (startIndex >= total) { startIndex = total; } if (endIndex < 0) { endIndex = 0; } c = Character.toLowerCase(c); for (int i = startIndex; i >= endIndex; --i) { if (Character.toLowerCase(src.charAt(i)) == c) { return i; } } return -1; } public static int[] lastIndexOfIgnoreCase(final String s, final String[] arr) { return lastIndexOfIgnoreCase(s, arr, s.length()); } public static int[] lastIndexOfIgnoreCase(final String s, final String[] arr, final int fromIndex) { final int arrLen = arr.length; int index = -1; int last = -1; for (int j = 0; j < arrLen; ++j) { final int i = lastIndexOfIgnoreCase(s, arr[j], fromIndex); if (i != -1 && i > index) { index = i; last = j; } } int[] array; if (last == -1) { array = null; } else { final int[] array2 = array = new int[2]; array2[0] = last; array2[1] = index; } return array; } public static String toLowerCase(final String s) { return toLowerCase(s, null); } public static String toLowerCase(final String s, Locale locale) { if (s == null) { return null; } StringBuilder sb = null; for (int i = 0; i < s.length(); ++i) { final char c = s.charAt(i); if (c > '\u007f') { if (locale == null) { locale = Locale.getDefault(); } return s.toLowerCase(locale); } if (c >= 'A' && c <= 'Z') { if (sb == null) { sb = new StringBuilder(s); } sb.setCharAt(i, (char) (c + ' ')); } } if (sb == null) { return s; } return sb.toString(); } public static String toString(final Object value) { if (value == null) { return null; } return value.toString(); } }