mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -1819,6 +1819,18 @@ public class CharSequenceUtil {
|
||||
return StrSplitter.split(str.toString(), separator, limit, isTrim, ignoreEmpty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切分字符串,如果分隔符不存在则返回原字符串
|
||||
*
|
||||
* @param str 被切分的字符串
|
||||
* @param separator 分隔符
|
||||
* @return 字符串
|
||||
* @since 5.7.1
|
||||
*/
|
||||
public static List<String> split(CharSequence str, CharSequence separator) {
|
||||
return split(str, separator, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切分字符串
|
||||
*
|
||||
|
@@ -386,7 +386,6 @@ public class IdcardUtil {
|
||||
}
|
||||
|
||||
// 首字母A-Z,A表示1,以此类推
|
||||
char start = idcard.charAt(0);
|
||||
String mid = card.substring(1, 7);
|
||||
String end = card.substring(7, 8);
|
||||
char[] chars = mid.toCharArray();
|
||||
|
@@ -73,7 +73,7 @@ public class BeanUtilTest {
|
||||
|
||||
@Test
|
||||
public void fillBeanWithMapIgnoreCaseTest() {
|
||||
HashMap<String, Object> map = CollUtil.newHashMap();
|
||||
HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("Name", "Joe");
|
||||
map.put("aGe", 12);
|
||||
map.put("openId", "DFDFSDFWERWER");
|
||||
@@ -104,7 +104,7 @@ public class BeanUtilTest {
|
||||
*/
|
||||
@Test
|
||||
public void toBeanIgnoreErrorTest() {
|
||||
HashMap<String, Object> map = CollUtil.newHashMap();
|
||||
HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("name", "Joe");
|
||||
// 错误的类型,此处忽略
|
||||
map.put("age", "aaaaaa");
|
||||
@@ -117,7 +117,7 @@ public class BeanUtilTest {
|
||||
|
||||
@Test
|
||||
public void mapToBeanIgnoreCaseTest() {
|
||||
HashMap<String, Object> map = CollUtil.newHashMap();
|
||||
HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("Name", "Joe");
|
||||
map.put("aGe", 12);
|
||||
|
||||
@@ -128,12 +128,12 @@ public class BeanUtilTest {
|
||||
|
||||
@Test
|
||||
public void mapToBeanTest() {
|
||||
HashMap<String, Object> map = CollUtil.newHashMap();
|
||||
HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("a_name", "Joe");
|
||||
map.put("b_age", 12);
|
||||
|
||||
// 别名,用于对应bean的字段名
|
||||
HashMap<String, String> mapping = CollUtil.newHashMap();
|
||||
HashMap<String, String> mapping = MapUtil.newHashMap();
|
||||
mapping.put("a_name", "name");
|
||||
mapping.put("b_age", "age");
|
||||
|
||||
@@ -147,7 +147,7 @@ public class BeanUtilTest {
|
||||
*/
|
||||
@Test
|
||||
public void mapToBeanTest2() {
|
||||
HashMap<String, Object> map = CollUtil.newHashMap();
|
||||
HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("name", "Joe");
|
||||
map.put("age", 12);
|
||||
|
||||
|
@@ -38,9 +38,9 @@ public class ListUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void filterTest(){
|
||||
public void editTest(){
|
||||
List<String> a = ListUtil.toLinkedList("1", "2", "3");
|
||||
final List<String> filter = ListUtil.filter(a, str -> "edit" + str);
|
||||
final List<String> filter = ListUtil.edit(a, str -> "edit" + str);
|
||||
Assert.assertEquals("edit1", filter.get(0));
|
||||
Assert.assertEquals("edit2", filter.get(1));
|
||||
Assert.assertEquals("edit3", filter.get(2));
|
||||
|
Reference in New Issue
Block a user