導航:首頁 > 凈水問答 > asp過濾中文字元

asp過濾中文字元

發布時間:2022-08-18 22:10:42

❶ asp 過濾字元 調用

Function ReqNum( StrName )
ReqNum = Request( StrName )
if Not isNumeric( ReqNum ) then
Response.Write "參數必須為數字型!"
Response.End
End if
End Function

Function ReqStr(ReqS)
dim StrName
StrName=request(ReqS)
StrName=replace(StrName,"'","")
StrName=replace(StrName,"%20","")
StrName=replace(StrName,"and","")
StrName=replace(StrName,"or","")
StrName=replace(StrName," ","")
StrName=replace(StrName,"select","")
StrName=replace(StrName,"update","")
StrName=replace(StrName,"delete","")
ReqStr=StrName
End Function

int和string類型的非法字元過濾,可以寫在conn.asp里,調用資料庫的時候,string格式用reqstr("")調用, int格式用regnum("")調用,不知道你問的是不是這個

❷ asp中如何過濾掉特殊字元

user=replace(trim(request.form("uName")),"'","''")
password=replace(trim(request.form("Password")),"'","''")
if instr(user,"%") or instr(user,"#") or instr(user,"?") or instr(user,"|") or instr(user,"'") then
response.write "<script language=javascript>alert('您的姓名含有非法字元!');this.location.href='login.asp';</script>"
response.end
end if

if instr(password,"%") or instr(password,"#") or instr(password,"?") or instr(password,"|") then
response.write "<script language=javascript>alert('您的密碼含有非法字元!');this.location.href='login.asp';</script>"
response.end
end if 我自己做的,希望對你有幫助

❸ asp 過濾某字元串中間值

可以參考一下
<%
function replaceByReg(str1,patrn,str)
dim tempReg
set tempReg=new RegExp
tempReg.IgnoreCase=true
tempReg.Global=true
tempReg.pattern=patrn
str1=tempReg.replace(str1,str)
set tempReg=nothing
replaceByReg = str1
end function
str1="【案例十八】學生成專績好壞與未來的屬關系"
patrn="【[\s\S]+?】"
str=""
Response.Write replaceByReg(str1,patrn,str)
%>

❹ ASP如何實現過濾字元(替換字元)

a="hello,who are <br> your ?"
a=Replace(a,"<br>","") 答案補充 a="hello,who are <br> your ?"
a=Replace(a,"<br>","")
a=Replace(a,"your","you") 答案補充 說明一下吧:
Replace是替換函數,格式如下:這個是先定義a這個變數,已經是有內容的了,第二句是把這句話的<br>給過濾掉<Br>,到第三句的時候,a中的<br>已經過濾掉了,再過濾掉your改成you

例子: 答案補充 變數名=Replace(變數名,"過濾的內容","要替換的內容")

❺ 在asp中怎麼過濾用戶輸入的非法字元

<%
dim texts
texts=request("表單明")

dim kill '要過濾的字元
kill="牆,垃,圍毆" '比喻

dim rsss
rsss=split(kill,",")
dim i,xxxx,yyyy
for i=0 to ubound(rsss)
xxxx=len(rsss(i))
dim j
for j=1 to xxxx
yyyy=yyyy&"*"
next
dim zzzz '過濾後的字元串
if i=0 then zzzz=texts
'如果你想把過濾字版符換成*
zzzz=replace(zzzz,rsss(i),yyyy)
'如果你想把過濾字元直接去掉
zzzz=replace(zzzz,rsss(i),"")
next

'zzzz就是過權濾後的字元了
%>

❻ ASP中如何過濾指字文字前或指定文字後所有內容呢

可以用正則進行替換,例如以下代碼可以替換a及以後的內所有容字元
<%
str="1234agds34.32"
Dim regEx
Set regEx=new RegExp
regEx.pattern="a.*"
regEx.IgnoreCase =false
regEx.Global=True
str=regEx.Replace(str,"00000")
Response.Write "aaa="&str
%>

❼ 利用ASP 去掉中文字,只留下數字。求幫助

functiongetdg(ms)
dimi,t,s,ss
i=0
dimaa()
fort=1tolen(mstr)
s=mid(mstr,t,1)
ifasc(s)>=48andasc(s)<=57then
ss=ss&s
else
ifss<>""then
redimpreserveaa(i)
aa(i)=ss
i=i+1
ss=""
endif
endif
next
getdg=aa
endfunction
mstr="正品實拍新款女裝修身加厚雙排扣大毛領可拆中長款羽絨棉衣棉服6029新款正品韓版女裝大翻領皮袖毛呢外套1107出貨正品冬季新款韓版通勤高領純色麻花修身淑女毛衣連衣裙5087#-"
dimaa
aa=getdg(mstr)
fort=0toubound(aa)
response.writeaa(t)&","
next

❽ asp 過濾中文字元

可以用正則表達式
就按照163郵箱的格式
·由字母a~z(不區分大小寫)、數字0~9、點、減號或下劃線組成
·只能以數字或字母開頭和結尾,例如:beijing.2008
·用戶名長度為4~18個字元
正則表達式這樣寫:
^[a-zA-Z0-9][\w-\.\d]{3,17}\@[a-zA-Z0-9]+\.[a-zA-Z]{2,4}

❾ 高手進:asp怎麼把文本過濾漢字,字母後只留下數字

<%
function getNum(str)
dim re
set re=new RegExp
re.pattern="\D"
re.global=true
getNum = re.replace(str, "")
end function
%>

<%
a="http://aiyaha.cn/bbs/txt.asp?d=173158.net,http://aiyaha.cn/bbs/txt.asp?d=126.com網址9"
response.write getNum(a)
%>

運行結果:1731581269

閱讀全文

與asp過濾中文字元相關的資料

熱點內容
污水處理氧化還原電位 瀏覽:353
美的1519飲水機什麼時間上市的 瀏覽:487
柴油濾芯對車有什麼影響 瀏覽:636
浙江塗裝濾芯廠家哪裡有 瀏覽:725
清山泉凈水器哪個好 瀏覽:824
603b過濾怎麼用 瀏覽:761
微溶能過濾 瀏覽:896
水垢能通過奶嘴嗎 瀏覽:978
污水主處理工藝比對 瀏覽:519
節能飲水機怎麼安裝 瀏覽:781
是離子交換分離某些元素的主要依據 瀏覽:288
高錳酸鉀能除垢嗎 瀏覽:217
洗浴電鍍龍頭除垢 瀏覽:947
生活用水和污水為什麼分流 瀏覽:462
工業廢水cod濃度約多少 瀏覽:354
凈水器三個濾芯都是什麼芯 瀏覽:969
只為了凈化空氣買什麼牌子凈化器 瀏覽:405
EDI說法正確 瀏覽:384
反滲透膜推力架 瀏覽:626
檔案室凈化器怎麼使用 瀏覽:212