StringUtil 工具類 過濾作用

2021-05-21 20:02:28 字數 568 閱讀 7103

package com.lzg.guestbook;

public class stringutil

else

}public static string changenull(string source, string target)

else

}public static string filterhtml(string input)

if (input.length() == 0)

input = input.replaceall("&", "&");

input = input.replaceall("<", "<");

input = input.replaceall(">", ">");

input = input.replaceall(" ", " ");

input = input.replaceall("'", "'");

input = input.replaceall("/"", """);

input = input.replaceall("/n", "

");return null;}}

StringUtil工具類常用方法

1.isempty string str 是否為空,空格字元為false 2.isnotempty string str 是否為非空,空格字元為true 3.isblank string str 是否為空,空格字元為true 4.isnotblank string str 是否為非空,空格字元為fa...

Gson簡單過濾工具類封裝

test public void teststrategy override public boolean shouldskipclass class clazz setfieldnamingstrategy new fieldnamingstrategy create employee emplo...

Javav中危險字元過濾工具類

在進行 開發時,為了避免 遭到sql語句的注入式攻擊,應該考慮到過濾字串中的危險字元。在該例項中,可以過濾 等字元時,在處理頁面中會把這些字元過濾掉 該示例主要利用string的replaceall方法 public string replaceall string regex,string rep...