package com.lzg.guestbook;
public class StringUtil
{
public static boolean validateNull(String args)
{
if ((args == null) || (args.length() == 0))
{
return true;
} else
{
return false;
}
}
public static String changeNull(String source, String target)
{
if ((source == null) || (source.length() == 0) || (source.equals("null")))
{
return target;
} else
{
return source;
}
}
public static String filterHtml(String input)
{
if (input == null)
{
return null;
}
if (input.length() == 0)
{
return input;
}
input = input.replaceAll("&", "&");
input = input.replaceAll("<", "<");
input = input.replaceAll(">", ">");
input = input.replaceAll(" ", " ");
input = input.replaceAll("'", "'");
input = input.replaceAll("/"", """);
input = input.replaceAll("/n", "<br>");
return null;
}
}
StringUtil 工具类 过滤作用
最新推荐文章于 2021-05-10 00:24:05 发布