This commit is contained in:
Looly
2022-05-10 18:13:50 +08:00
parent 3df525409b
commit 15d4f786b2
4 changed files with 28 additions and 4 deletions

View File

@@ -780,6 +780,28 @@ public class CharSequenceUtil {
return false;
}
/**
* 给定字符串是否以任何一个字符串结尾(忽略大小写)<br>
* 给定字符串和数组为空都返回false
*
* @param str 给定字符串
* @param suffixes 需要检测的结尾字符串
* @return 给定字符串是否以任何一个字符串结尾
* @since 5.8.1
*/
public static boolean startWithAnyIgnoreCase(final CharSequence str, final CharSequence... suffixes) {
if (isEmpty(str) || ArrayUtil.isEmpty(suffixes)) {
return false;
}
for (final CharSequence suffix : suffixes) {
if (startWith(str, suffix, true)) {
return true;
}
}
return false;
}
// ------------------------------------------------------------------------ endWith
/**
@@ -2707,7 +2729,7 @@ public class CharSequenceUtil {
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
* 例:<br>
* 通常使用format("this is {} for {}", "a", "b") =》 this is a for b<br>
* 转义{} format("this is \\{} for {}", "a", "b") =》 this is \{} for a<br>
* 转义{} format("this is \\{} for {}", "a", "b") =》 this is {} for a<br>
* 转义\ format("this is \\\\{} for {}", "a", "b") =》 this is \a for b<br>
*
* @param template 文本模板,被替换的部分用 {} 表示如果模板为null返回"null"