|
|
@@ -12,7 +12,7 @@ import com.ruoyi.common.core.text.StrFormatter;
|
|
|
|
|
|
/**
|
|
|
* 字符串工具类
|
|
|
- *
|
|
|
+ *
|
|
|
* @author ruoyi
|
|
|
*/
|
|
|
public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
@@ -25,7 +25,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 获取参数不为空值
|
|
|
- *
|
|
|
+ *
|
|
|
* @param value defaultValue 要判断的value
|
|
|
* @return value 返回值
|
|
|
*/
|
|
|
@@ -36,7 +36,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个Collection是否为空, 包含List,Set,Queue
|
|
|
- *
|
|
|
+ *
|
|
|
* @param coll 要判断的Collection
|
|
|
* @return true:为空 false:非空
|
|
|
*/
|
|
|
@@ -47,7 +47,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个Collection是否非空,包含List,Set,Queue
|
|
|
- *
|
|
|
+ *
|
|
|
* @param coll 要判断的Collection
|
|
|
* @return true:非空 false:空
|
|
|
*/
|
|
|
@@ -58,7 +58,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个对象数组是否为空
|
|
|
- *
|
|
|
+ *
|
|
|
* @param objects 要判断的对象数组
|
|
|
** @return true:为空 false:非空
|
|
|
*/
|
|
|
@@ -69,7 +69,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个对象数组是否非空
|
|
|
- *
|
|
|
+ *
|
|
|
* @param objects 要判断的对象数组
|
|
|
* @return true:非空 false:空
|
|
|
*/
|
|
|
@@ -80,7 +80,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个Map是否为空
|
|
|
- *
|
|
|
+ *
|
|
|
* @param map 要判断的Map
|
|
|
* @return true:为空 false:非空
|
|
|
*/
|
|
|
@@ -91,7 +91,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个Map是否为空
|
|
|
- *
|
|
|
+ *
|
|
|
* @param map 要判断的Map
|
|
|
* @return true:非空 false:空
|
|
|
*/
|
|
|
@@ -102,7 +102,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个字符串是否为空串
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str String
|
|
|
* @return true:为空 false:非空
|
|
|
*/
|
|
|
@@ -113,7 +113,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个字符串是否为非空串
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str String
|
|
|
* @return true:非空串 false:空串
|
|
|
*/
|
|
|
@@ -124,7 +124,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个对象是否为空
|
|
|
- *
|
|
|
+ *
|
|
|
* @param object Object
|
|
|
* @return true:为空 false:非空
|
|
|
*/
|
|
|
@@ -135,7 +135,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个对象是否非空
|
|
|
- *
|
|
|
+ *
|
|
|
* @param object Object
|
|
|
* @return true:非空 false:空
|
|
|
*/
|
|
|
@@ -146,7 +146,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* * 判断一个对象是否是数组类型(Java基本型别的数组)
|
|
|
- *
|
|
|
+ *
|
|
|
* @param object 对象
|
|
|
* @return true:是数组 false:不是数组
|
|
|
*/
|
|
|
@@ -165,7 +165,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 截取字符串
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str 字符串
|
|
|
* @param start 开始
|
|
|
* @return 结果
|
|
|
@@ -196,7 +196,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 截取字符串
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str 字符串
|
|
|
* @param start 开始
|
|
|
* @param end 结束
|
|
|
@@ -248,7 +248,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
|
|
|
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
|
|
|
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
|
|
|
- *
|
|
|
+ *
|
|
|
* @param template 文本模板,被替换的部分用 {} 表示
|
|
|
* @param params 参数值
|
|
|
* @return 格式化后的文本
|
|
|
@@ -264,7 +264,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 是否为http(s)://开头
|
|
|
- *
|
|
|
+ *
|
|
|
* @param link 链接
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@@ -275,7 +275,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 字符串转set
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str 字符串
|
|
|
* @param sep 分隔符
|
|
|
* @return set集合
|
|
|
@@ -287,7 +287,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 字符串转list
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str 字符串
|
|
|
* @param sep 分隔符
|
|
|
* @param filterBlank 过滤纯空白
|
|
|
@@ -424,7 +424,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 是否包含字符串
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str 验证字符串
|
|
|
* @param strs 字符串组
|
|
|
* @return 包含返回true
|
|
|
@@ -446,7 +446,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
|
|
|
- *
|
|
|
+ *
|
|
|
* @param name 转换前的下划线大写方式命名的字符串
|
|
|
* @return 转换后的驼峰式命名的字符串
|
|
|
*/
|
|
|
@@ -520,7 +520,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
|
|
|
- *
|
|
|
+ *
|
|
|
* @param str 指定字符串
|
|
|
* @param strs 需要检查的字符串数组
|
|
|
* @return 是否匹配
|
|
|
@@ -542,11 +542,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 判断url是否与规则配置:
|
|
|
- * ? 表示单个字符;
|
|
|
- * * 表示一层路径内的任意字符串,不可跨层级;
|
|
|
+ * 判断url是否与规则配置:
|
|
|
+ * ? 表示单个字符;
|
|
|
+ * * 表示一层路径内的任意字符串,不可跨层级;
|
|
|
* ** 表示任意层路径;
|
|
|
- *
|
|
|
+ *
|
|
|
* @param pattern 匹配规则
|
|
|
* @param url 需要匹配的url
|
|
|
* @return
|
|
|
@@ -565,7 +565,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。
|
|
|
- *
|
|
|
+ *
|
|
|
* @param num 数字对象
|
|
|
* @param size 字符串指定长度
|
|
|
* @return 返回数字的字符串格式,该字符串为指定长度。
|
|
|
@@ -577,7 +577,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
|
|
|
/**
|
|
|
* 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。
|
|
|
- *
|
|
|
+ *
|
|
|
* @param s 原始字符串
|
|
|
* @param size 字符串指定长度
|
|
|
* @param c 用于补齐的字符
|
|
|
@@ -611,4 +611,19 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|
|
}
|
|
|
return sb.toString();
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ public static String[] splitString(String staffName) {
|
|
|
+ if (staffName.length() > 0){
|
|
|
+ if (staffName.contains(",")){
|
|
|
+ return staffName.split(",");
|
|
|
+ }else if (staffName.contains(",")){
|
|
|
+ return staffName.split(",");
|
|
|
+ }else if (staffName.contains("/")){
|
|
|
+ return staffName.split("/");
|
|
|
+ }else {
|
|
|
+ return staffName.split(" ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|