推薦:ASP中的EVAL函數使用教程近兩日,學習了ASP的EVAL函數。感覺上很實用,如果使用得當,能減輕很多代碼的編寫量,也使得代碼更加簡潔明了。 EVAL函數的原型: EVAL(expression) 其中expression是字符串參數,可以是表達式,可以是變量,甚至可以是語句。但都是以字符串的形式出現。 例如b=EVA
Function FormatStr(str)
Dim s1,s2
If str<> then
str=replace(replace(Trim(str),chr(32)&chr(32),),chr(9),)
DO While (instr(str,>)>0 and instr(str,<)>0)
s1=InStr(str,<)
s2=Instr(s1,str,>)
If s1>0 and s2>0 then
str=replace(str,mid(str,s1,s2-s1+1),)
End if
Loop
str=replace(replace(str,<,<),>,>)
str=Replace(Replace(Replace(replace(replace(str,chr(13),),chr(10),),,),','), ,)
FormatStr=str
Else
FormatStr=
End if
End Function
分享:ASP 高亮顯示不區分大小寫的關鍵字今日,碰到一個問題:如何在網頁中高亮顯示不區分大小寫的關鍵字例如:文本abcaBcabCaBCabcaBCa,關鍵字bc,在不區分大小寫的情況,一共有6個匹配項。 則在網頁中顯示的是abcaBcabCaBCabcaBCa。 很多人,想到是replace函數。原型為Replace(string,find,replacewith[,