Java过滤特殊符号
程序员文章站
2022-05-26 17:55:33
...
public class Tool {
private static String[] noChar={"'","%","^","&","?","(",")","<",">","[","]","{","}","/","\\",";",":","--","\""," "}; //检查是否包含特殊字符
public static boolean YanZheng(String zifu)
{
for(int i=0;i<noChar.length;i++)
{
if(zifu.contains(noChar[i]))
{
return false;
}
}
return true;
}
public static boolean YanZheng(String zifu,String zifu2)
{
for(int i=0;i<noChar.length;i++)
{
if(zifu.contains(noChar[i]) || zifu2.contains(noChar[i]))
{
return false;
}
}
return true;
}
}
上一篇: hbuilder开发遇到的问题 真机与 内置浏览器
下一篇: java全角半角转换