|
@@ -661,6 +661,57 @@ public class Func {
|
|
|
return Arrays.asList(toIntArray(split, str));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 转换为Long数组<br>
|
|
|
+ *
|
|
|
+ * @param str 被转换的值
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ public static Long[] toLongArray(String str) {
|
|
|
+ return toLongArray(",", str);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转换为Long数组<br>
|
|
|
+ *
|
|
|
+ * @param split 分隔符
|
|
|
+ * @param str 被转换的值
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ public static Long[] toLongArray(String split, String str) {
|
|
|
+ if (StringUtil.isEmpty(str)) {
|
|
|
+ return new Long[]{};
|
|
|
+ }
|
|
|
+ String[] arr = str.split(split);
|
|
|
+ final Long[] longs = new Long[arr.length];
|
|
|
+ for (int i = 0; i < arr.length; i++) {
|
|
|
+ final Long v = toLong(arr[i], 0);
|
|
|
+ longs[i] = v;
|
|
|
+ }
|
|
|
+ return longs;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转换为Long集合<br>
|
|
|
+ *
|
|
|
+ * @param str 结果被转换的值
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ public static List<Long> toLongList(String str) {
|
|
|
+ return Arrays.asList(toLongArray(str));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转换为Long集合<br>
|
|
|
+ *
|
|
|
+ * @param split 分隔符
|
|
|
+ * @param str 被转换的值
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ public static List<Long> toLongList(String split, String str) {
|
|
|
+ return Arrays.asList(toLongArray(split, str));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 转换为String数组<br>
|
|
|
*
|