fix(TDI-42183): Avoid locale dependent checks (#2715)
* fix(TDI-42183): Avoid locale dependent checks * fix(TDI-42183): declare the code come from apache commons lang
This commit is contained in:
@@ -403,8 +403,25 @@ public class StringUtils {
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* check if string contains search string case-insensitivity
|
||||
* the code is copied from apache commons-lang3 StringUtils and do some adjust to avoid the useless code
|
||||
*/
|
||||
public static boolean containsIgnoreCase(final String str, final String searchStr) {
|
||||
if (str == null || searchStr == null) {
|
||||
return false;
|
||||
}
|
||||
final int len = searchStr.length();
|
||||
final int max = str.length() - len;
|
||||
for (int i = 0; i <= max; i++) {
|
||||
if (str.regionMatches(true, i, searchStr, 0, len)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* return null value not "null" String when obj is null that is the only difference with String.valueOf(Object obj)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user