StrUtil添加subBetweenAll()方法

This commit is contained in:
大火yzs
2020-03-27 17:59:55 +08:00
parent 54760ea0a2
commit a0c78cf53c
4 changed files with 103 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ package cn.hutool.core.lang;
import org.junit.Ignore;
import org.junit.Test;
import cn.hutool.core.lang.Console;
import cn.hutool.core.thread.ThreadUtil;
/**
@@ -57,4 +56,5 @@ public class ConsoleTest {
ThreadUtil.sleep(200);
}
}
}

View File

@@ -421,5 +421,11 @@ public class StrUtilTest {
Assert.assertEquals("1AB", StrUtil.padAfter("1", 3, "ABC"));
Assert.assertEquals("23", StrUtil.padAfter("123", 2, "ABC"));
}
@Test
public void subBetweenAllTest() {
Assert.assertArrayEquals(new String[]{"yz","abc"},StrUtil.subBetweenAll("saho[yz]fdsadp[abc]a","\\[","\\]"));
Assert.assertArrayEquals(new String[]{"abc"}, StrUtil.subBetweenAll("saho[yzfdsadp[abc]a]","\\[","\\]"));
}
}