StringUtil.java 1.24 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
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 "";
}
}