asp字元替換

2021-04-16 07:08:31 字數 892 閱讀 5220

<%

st = "你好,請問你是的嗎?希望能支援我們的調查."

dim a(2),b(2)

a(0) = ""

a(1) = ""

a(2) = ""

b(0) = "alex"

b(1) = "先生"

b(2) = "電信"

function replacetest(patrn, replstr)

dim regex'建立變數。

set regex = new regexp '建立正規表示式。

regex.pattern = patrn '設定模式。

regex.ignorecase = false '設定是否區分大小寫。

replacetest = regex.replace(st, replstr) '作替換。

end function

function regexptest(patrn, strng)    '查詢字元

dim regex, retval '建立變數。

set regex = new regexp '建立正規表示式。

regex.pattern = patrn ' 設定模式。

regex.ignorecase = false ' 設定是否區分大小寫。

retval = regex.test(strng) ' 執行搜尋測試。

regexptest = retval

end function

for i = 0 to 2

while regexptest(a(i),st)

st = replacetest(a(i), b(i))

wend

next

response.write st

%>

非法字元替換,防SQL注入 asp

函式名 checkstr byval chkstr 作用 非法字元替換,防sql注入 function checkstr byval chkstr dim str str chkstr str trim str if isnull str then checkstr exit function en...

替換 M字元

關於回車與換行 很久以前,老式的電傳打字機使用兩個字元來另起新行。乙個字元把滑動架移回首位 稱為回車,ascii碼為0d 另乙個字元把紙上移一行 稱為換行,ascii碼為0a 當計算機問世以後,儲存器曾經非常昂貴。有些人就認定沒必要用兩個字元來表示行尾。unix 開發者決定他們可以用乙個字元來表示行...

oracle 字元替換

摘自 使用replace函式 測試語句 select replace 你好變 變 站 from dual 正式語句 update test set name replace name,變 站 可以切割字串 測試語句 selectreplace substr xx變 xx變 1,instr xx變 x...