puzhibing
2023-11-28 7b726d5ff439e7b8bb66369ecc5881e370286bc8
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
package com.stylefeng.guns.modular.system.util;
 
import java.util.List;
 
public class EmptyUtil {
    /**
     * 判断对象为空
     *
     * @param obj
     *      对象名
     * @return 是否为空
     */
    @SuppressWarnings("rawtypes")
    public static boolean isEmpty(Object obj)
    {
        if (obj == null)
        {
            return true;
        }
        if ((obj instanceof List))
        {
            return ((List) obj).size() == 0;
        }
        if ((obj instanceof String))
        {
            return ((String) obj).trim().equals("");
        }
        return false;
    }
 
    /**
     * 判断对象不为空
     *
     * @param obj
     *      对象名
     * @return 是否不为空
     */
    public static boolean isNotEmpty(Object obj)
    {
        return !isEmpty(obj);
    }
 
 
    /**
     * 富文本格式转换
     * @param value
     * @return
     */
    public static String cleanXSS(String value) {
        //You'll need to remove the spaces from the html entities below
        value = value.replaceAll("& lt;", "<").replaceAll("& gt;", ">");
        value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;");
        return value;
    }
}