Parcourir la source

:zap: 优化代码

smallchill il y a 6 ans
Parent
commit
d022c1bb6a

+ 43 - 1
blade-core-tool/src/main/java/org/springblade/core/tool/utils/Func.java

@@ -625,7 +625,7 @@ public class Func {
 	 * 转换为Integer数组<br>
 	 *
 	 * @param split 分隔符
-	 * @param split 被转换的值
+	 * @param str   被转换的值
 	 * @return 结果
 	 */
 	public static Integer[] toIntArray(String split, String str) {
@@ -641,6 +641,27 @@ public class Func {
 		return ints;
 	}
 
+	/**
+	 * 转换为Integer集合<br>
+	 *
+	 * @param str 结果被转换的值
+	 * @return 结果
+	 */
+	public static List<Integer> toIntList(String str) {
+		return Arrays.asList(toIntArray(str));
+	}
+
+	/**
+	 * 转换为Integer集合<br>
+	 *
+	 * @param split 分隔符
+	 * @param str   被转换的值
+	 * @return 结果
+	 */
+	public static List<Integer> toIntList(String split, String str) {
+		return Arrays.asList(toIntArray(split, str));
+	}
+
 	/**
 	 * 转换为String数组<br>
 	 *
@@ -665,6 +686,27 @@ public class Func {
 		return str.split(split);
 	}
 
+	/**
+	 * 转换为String集合<br>
+	 *
+	 * @param str 结果被转换的值
+	 * @return 结果
+	 */
+	public static List<String> toStrList(String str) {
+		return Arrays.asList(toStrArray(str));
+	}
+
+	/**
+	 * 转换为String集合<br>
+	 *
+	 * @param split 分隔符
+	 * @param str   被转换的值
+	 * @return 结果
+	 */
+	public static List<String> toStrList(String split, String str) {
+		return Arrays.asList(toStrArray(split, str));
+	}
+
 	/**
 	 * 将 long 转短字符串 为 62 进制
 	 *