package com.lyms.talkonlineweb.util;
/**
* @ProjectName: talkonline
* @Package: com.lyms.talkonlineweb.util
* @ClassName: Stringutil
* @Author: lqy
* @Description: 字符串处理类
* @Date: 2021-09-07 17:50
* @Version:
*/
public class StringUtil {
public static boolean isEmpty(String str) {
if (str == null || "".equals(str)) {
return true;
}
return false;
}
public static boolean isNotEmpty(String str) {
if (str != null && !"".equals(str)) {
return true;
}
return false;
}
/**
* //+表示1个或多个(如"3"或"225"),*表示0个或多个([0-9]*)(如""或"1"或"22"),
* ?表示0个或1个([0-9]?)(如""或"7")
*
* @param str
* @return
*/
public static boolean isNum(String str) {
if (!isEmpty(str)) {
return str.matches("[0-9]+");
}
return false;
}
/**
* 生成一个唯一编号
* @return
*/
public static String getUniqueNo()
{
try
{
return String.format("%s%s%06d", "D", DateUtil.getSeqString(), IdWorker.getFlowIdWorkerInstance().nextId());
}catch (Exception e){
}
return "";
}
}