将输入框内容进行修改及替换html标签

来源:互联网 发布:淘宝psv游戏 编辑:程序博客网 时间:2024/06/06 09:53
//将空格和汉字进行替换String authCode = "倒萨 a";try {authCode = URLEncoder.encode(authCode, "UTF-8");}catch (Exception e){}System.out.println(authCode);String text = "用户名或密码不正确,还有3次机会。<a href=\\\"https://uac.10010.com/cust/resetpass/resetpassInit\\\" target=\\\"_blank\\\" style=\\\"color: #36c;cursor: pointer;text-decoration:underline;\\\">忘记密码?</a>";//去掉html及其内容String error = text.replaceAll("<[^>]+>.*<[^>]+>", "");System.out.println(error);//去掉html标签error = text.replaceAll("<[^>]+>", "");System.out.println(error);

输出结果:

%E5%80%92%E8%90%A8+a用户名或密码不正确,还有3次机会。用户名或密码不正确,还有3次机会。忘记密码?


0 0
原创粉丝点击