本文整理匯總了Java中org.apache.commons.lang3.StringUtils.indexOfIgnoreCase方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.indexOfIgnoreCase方法的具體用法?Java StringUtils.indexOfIgnoreCase怎麽用?Java StringUtils.indexOfIgnoreCase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.indexOfIgnoreCase方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getResponseFileName
import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
* 從響應消息的Content-Disposition頭中獲得文件名。
*
* @param headers
* @return 如果不是文件則返回null
*/
private static String getResponseFileName(Header[] headers) {
String filename = null;
if (headers == null) {
return null;
}
for (Header header : headers) {
if (StringUtils.equalsIgnoreCase(header.getName(), "Content-Disposition")) {
String value = header.getValue();
String key = "filename=";
int keyLength = key.length();
int position = StringUtils.indexOfIgnoreCase(header.getValue(), key);
if (position > -1) {
filename = StringUtils.substring(value, position + keyLength);
}
break;
}
}
return filename;
}
示例2: extractUsername
import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
* Extracts the username from the specified DN. If the username cannot be extracted because the CN is in an unrecognized format, the entire CN is returned. If the CN cannot be extracted because
* the DN is in an unrecognized format, the entire DN is returned.
*
* @param dn the dn to extract the username from
* @return the exatracted username
*/
public static String extractUsername(String dn) {
String username = dn;
// ensure the dn is specified
if (StringUtils.isNotBlank(dn)) {
// determine the separate
final String separator = StringUtils.indexOfIgnoreCase(dn, "/cn=") > 0 ? "/" : ",";
// attempt to locate the cd
final String cnPattern = "cn=";
final int cnIndex = StringUtils.indexOfIgnoreCase(dn, cnPattern);
if (cnIndex >= 0) {
int separatorIndex = StringUtils.indexOf(dn, separator, cnIndex);
if (separatorIndex > 0) {
username = StringUtils.substring(dn, cnIndex + cnPattern.length(), separatorIndex);
} else {
username = StringUtils.substring(dn, cnIndex + cnPattern.length());
}
}
}
return username;
}
示例3: handleIndex
import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
protected int handleIndex(CharSequence str, CharSequence searchStr, int startPos) {
return StringUtils.indexOfIgnoreCase(str, searchStr, startPos);
}