mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复ReUtil.delAll方法当 content 仅为空格时的问题
This commit is contained in:
@@ -459,7 +459,7 @@ public class ReUtil {
|
||||
* @return 删除后剩余的内容
|
||||
*/
|
||||
public static String delAll(String regex, CharSequence content) {
|
||||
if (StrUtil.hasBlank(regex, content)) {
|
||||
if (StrUtil.hasEmpty(regex, content)) {
|
||||
return StrUtil.str(content);
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ public class ReUtil {
|
||||
* @return 删除后剩余的内容
|
||||
*/
|
||||
public static String delAll(Pattern pattern, CharSequence content) {
|
||||
if (null == pattern || StrUtil.isBlank(content)) {
|
||||
if (null == pattern || StrUtil.isEmpty(content)) {
|
||||
return StrUtil.str(content);
|
||||
}
|
||||
|
||||
|
@@ -210,4 +210,9 @@ public class ReUtilTest {
|
||||
final String s = ReUtil.replaceAll("1.2.3.4", patternIp, "$1.**.**.$10");
|
||||
Assert.assertEquals("1.**.**.4", s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void issueI6GIMTTest(){
|
||||
Assert.assertEquals(StrUtil.EMPTY, ReUtil.delAll("[\\s]*", " "));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user