Here you can find the source of subStringAfterIgnoreCase(String str, String separator, Integer num)
public static final String subStringAfterIgnoreCase(String str, String separator, Integer num)
//package com.java2s; //License from project: Open Source License public class Main { /**@see #subStringAfter(String, String, Integer, boolean) * @author hcqt@qq.com*/// ww w .j ava2 s . co m public static final String subStringAfterIgnoreCase(String str, String separator, Integer num) { return subStringAfter(str, separator, num, true); } /**@see #subStringAfter(String, String, Integer, Boolean) * @author hcqt@qq.com*/ public static final String subStringAfterIgnoreCase(String str, String separator) { return subStringAfter(str, separator, 1, true); } /**@see #subStringBefore(String, String, Integer, boolean) * @author hcqt@qq.com*/ public static final String subStringAfter(String str, String separator, Integer num) { return subStringAfter(str, separator, num, false); } /**@see #subStringBefore(String, String, Integer, boolean) * @author hcqt@qq.com*/ public static final String subStringAfter(String str, String separator) { return subStringAfter(str, separator, 1, false); } /**@see #subStringBefore(String, String, Integer, boolean) * @author hcqt@qq.com*/ public static final String subStringAfter(String str, String separator, Integer num, Boolean ignoreCase) { if (null == str) { return null; } if (null == separator) { return null; } if (Integer.signum(num) == 0) { return null; } if (ignoreCase == null) { ignoreCase = Boolean.FALSE; } int i = indexOf(str, separator, num, ignoreCase); if (i == -1) { return null; } else { return str.substring(i + separator.length()); } } /**@see #indexOf(String, String, Integer, Boolean) * @author hcqt@qq.com*/ public static final int indexOf(String str, String separator, Integer num) { return indexOf(str, separator, num, false); } public static final int indexOf(String str, String separator, Integer num, Boolean isIgnoreCase) { if (isIgnoreCase == null) { isIgnoreCase = Boolean.FALSE; } if (null == str) { return -1; } if (null == separator) { return -1; } if (isIgnoreCase) { str = str.toUpperCase(); separator = separator.toUpperCase(); } if (null == num) { num = Integer.valueOf(0); } if (Integer.signum(num) == 0) { return -1; } else if (Integer.signum(num) == 1) { int j = -1; for (int i = 0; i < num; i++) { if (j == -1) { j = str.indexOf(separator, 0); } else { j = str.indexOf(separator, j + 1); } if (j == -1) { break; } } return j; } else if (Integer.signum(num) == -1) { int j = -1; for (int i = 0; i < Math.abs(num); i++) { if (j == -1) { j = str.lastIndexOf(separator); } else { j = str.lastIndexOf(separator, j - 1); } if (j == -1) { break; } } return j; } return -1; } /**@see #subString(String, String, Integer, Integer, Boolean) * @author hcqt@qq.com*/ public static final String subString(String str, String separator, Integer stratNum, Integer endNum) { return subString(str, separator, stratNum, endNum, false); } /**@author hcqt@qq.com*/ public static final String subString(String str, String separator, Integer stratSeparatorNum, Integer endSeparatorNum, Boolean ignoreCase) { if (str == null || separator == null || stratSeparatorNum == null || endSeparatorNum == null) { return null; } int startIndex = indexOf(str, separator, stratSeparatorNum, ignoreCase); if (startIndex == -1) { return null; } startIndex = startIndex + separator.length(); int endIndex = indexOf(str, separator, endSeparatorNum, ignoreCase); if (endIndex == -1) { return null; } if (startIndex >= endIndex) { return null; } return str.substring(startIndex, endIndex); } }