This commit is contained in:
Looly 2022-01-07 19:59:46 +08:00
parent 38dd205b56
commit 506a8c2d3c
3 changed files with 12 additions and 1 deletions

View File

@ -25,6 +25,7 @@
* 【core 】 修复split空判断不一致问题pr#496@Gitee
* 【crypto 】 修复SM2.getDHex()前导0丢失,然后导致获取密钥错误pr#2073@Github
* 【core 】 修复关于Calculator.conversion()方法EmptyStackException的bugpr#2076@Github
* 【core 】 修复StrUtil.subBetweenAll循环bugissue#I4PT3M@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.7.18 (2021-12-25)

View File

@ -2336,7 +2336,9 @@ public class CharSequenceUtil {
}
} else {
int suffixIndex;
for (String fragment : split) {
String fragment;
for (int i = 1; i < split.length; i++) {
fragment = split[i];
suffixIndex = fragment.indexOf(suffix.toString());
if (suffixIndex > 0) {
result.add(fragment.substring(0, suffixIndex));

View File

@ -521,6 +521,14 @@ public class StrUtilTest {
Assert.assertEquals("abc", strings[0]);
}
@Test
public void subBetweenAllTest4() {
String str = "你好:1388681xxxx用户已开通,1877275xxxx用户已开通,无法发送业务开通短信";
String[] strings = StrUtil.subBetweenAll(str, "1877275xxxx", ",");
Assert.assertEquals(1, strings.length);
Assert.assertEquals("用户已开通", strings[0]);
}
@Test
public void briefTest() {
// case: 1 str.length - 1