/** * <p>Case in-sensitive find of the last index within a String.</p> * * <p>A <code>null</code> String will return <code>-1</code>. * A negative start position returns <code>-1</code>. * An empty ("") search String always matches unless the start position is negative. * A start position greater than the string length searches the whole string.</p> * * <pre> * StringUtils.lastIndexOfIgnoreCase(null, *) = -1 * StringUtils.lastIndexOfIgnoreCase(*, null) = -1 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4 * </pre> * * @param str the String to check, may be null * @param searchStr the String to find, may be null * @return the first index of the search String, * -1 if no match or <code>null</code> string input * @since 2.5 */ public static int lastIndexOfIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return INDEX_NOT_FOUND; } return lastIndexOfIgnoreCase(str, searchStr, str.length()); }
/** * <p>Case in-sensitive find of the last index within a String.</p> * * <p>A <code>null</code> String will return <code>-1</code>. * A negative start position returns <code>-1</code>. * An empty ("") search String always matches unless the start position is negative. * A start position greater than the string length searches the whole string.</p> * * <pre> * StringUtils.lastIndexOfIgnoreCase(null, *) = -1 * StringUtils.lastIndexOfIgnoreCase(*, null) = -1 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4 * </pre> * * @param str the String to check, may be null * @param searchStr the String to find, may be null * @return the first index of the search String, * -1 if no match or <code>null</code> string input * @since 2.5 */ public static int lastIndexOfIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return INDEX_NOT_FOUND; } return lastIndexOfIgnoreCase(str, searchStr, str.length()); }
/** * <p>Case in-sensitive find of the last index within a String.</p> * * <p>A <code>null</code> String will return <code>-1</code>. * A negative start position returns <code>-1</code>. * An empty ("") search String always matches unless the start position is negative. * A start position greater than the string length searches the whole string.</p> * * <pre> * StringUtils.lastIndexOfIgnoreCase(null, *) = -1 * StringUtils.lastIndexOfIgnoreCase(*, null) = -1 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4 * </pre> * * @param str the String to check, may be null * @param searchStr the String to find, may be null * @return the first index of the search String, * -1 if no match or <code>null</code> string input * @since 2.5 */ public static int lastIndexOfIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return -1; } return lastIndexOfIgnoreCase(str, searchStr, str.length()); }
/** * <p>Case in-sensitive find of the last index within a String.</p> * * <p>A <code>null</code> String will return <code>-1</code>. * A negative start position returns <code>-1</code>. * An empty ("") search String always matches unless the start position is negative. * A start position greater than the string length searches the whole string.</p> * * <pre> * StringUtils.lastIndexOfIgnoreCase(null, *) = -1 * StringUtils.lastIndexOfIgnoreCase(*, null) = -1 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4 * </pre> * * @param str the String to check, may be null * @param searchStr the String to find, may be null * @return the first index of the search String, * -1 if no match or <code>null</code> string input * @since 2.5 */ public static int lastIndexOfIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return -1; } return lastIndexOfIgnoreCase(str, searchStr, str.length()); }
/** * <p>Case in-sensitive find of the last index within a String.</p> * * <p>A <code>null</code> String will return <code>-1</code>. * A negative start position returns <code>-1</code>. * An empty ("") search String always matches unless the start position is negative. * A start position greater than the string length searches the whole string.</p> * * <pre> * StringUtils.lastIndexOfIgnoreCase(null, *) = -1 * StringUtils.lastIndexOfIgnoreCase(*, null) = -1 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4 * </pre> * * @param str the String to check, may be null * @param searchStr the String to find, may be null * @return the first index of the search String, * -1 if no match or <code>null</code> string input * @since 2.5 */ public static int lastIndexOfIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return INDEX_NOT_FOUND; } return lastIndexOfIgnoreCase(str, searchStr, str.length()); }
/** * <p>Case in-sensitive find of the last index within a String.</p> * * <p>A <code>null</code> String will return <code>-1</code>. * A negative start position returns <code>-1</code>. * An empty ("") search String always matches unless the start position is negative. * A start position greater than the string length searches the whole string.</p> * * <pre> * StringUtils.lastIndexOfIgnoreCase(null, *) = -1 * StringUtils.lastIndexOfIgnoreCase(*, null) = -1 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5 * StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4 * </pre> * * @param str the String to check, may be null * @param searchStr the String to find, may be null * @return the first index of the search String, * -1 if no match or <code>null</code> string input * @since 2.5 */ public static int lastIndexOfIgnoreCase(String str, String searchStr) { if (str == null || searchStr == null) { return INDEX_NOT_FOUND; } return lastIndexOfIgnoreCase(str, searchStr, str.length()); }