|
ASP中一个字符串处理类(加强)(VBScript)(5) '' @参数说明: - str [string]: 源字符串 '' @返回值: - [string] 转换后的字符串 '**************************************************************************** public function checkstr(Str) If Trim(Str)="" Or IsNull(str) Then checkstr="" else checkstr=Replace(Trim(Str),"'","''") end if End function '**************************************************************************** '' @功能说明: 将字符串中的str中的HTML代码进行过滤 '' @参数说明: - str [string]: 源字符串 '' @返回值: - [string] 转换后的字符串 '**************************************************************************** Public Function HtmlEncode(str) If Trim(Str)="" Or IsNull(str) then HtmlEncode="" else str=Replace(str,">",">") str=Replace(str,"<","<") str=Replace(str,Chr(32)," ") str=Replace(str,Chr(9)," ") str=Replace(str,Chr(34),""") str=Replace(str,Chr(39),"'") str=Replace(str,Chr(13),"") str=Replace(str,Chr(10) & Chr(10), "</p><p>") str=Replace(str,Chr(10),"<br> ") HtmlEncode=str end if End Function '**************************************************************************** '' @功能说明: 计算源字符串Str的长度(一个中文字符为2个字节长) '' @参数说明: - str [string]: 源字符串 '' @返回值: - [Int] 源字符串的长度 '**************************************************************************** Public Function strLen(Str) If Trim(Str)="" Or IsNull(str) Then strlen=0
|