注册 登录
编程论坛 ASP技术论坛

<%=rs("content")%>中的内容如何用replace

zmhdxy 发布于 2007-12-04 21:33, 1372 次点击
比如有
content=replace(content,"  ","  ")  '''''空格
'content=replace(content,chr(13)&chr(10),"<p>")   '''''软回车,如果要回车,把<br>改成<p>
如过谁有更多的那最好不过了
7 回复
#2
craft001wen2007-12-05 08:25
直接用trim(conternt)
#3
zmhdxy2007-12-06 15:34
楼上的错误理解我的意思了
我是举个例子而已
想把rs("content")中内容的特殊字符转换成html语言,然后在用
#4
tianyu1232007-12-06 19:07
'写个函数
Function geshi(str)
   str=Replace(str, CHR(38), "&")
   str=Replace(str, ">", "&gt;")
   str=Replace(str, "<", "&lt;")
   str=Replace(str, CHR(39), "'")
   str=Replace(str, CHR(32), "&nbsp;")
   str=Replace(str, CHR(34), "&quot;")
   str=Replace(str, CHR(13), "")
   str=Replace(str, CHR(10), "<br>")
   geshi=str
End Function

'调用即可

geshi(输出的内容)
#5
zmhdxy2007-12-10 11:16
上面的有错
str=Replace(str, CHR(34), """)
应该是
   str=Replace(str, CHR(34), "&quot;")
#6
gkkpx2007-12-10 15:59
在看看啊
#7
zmhdxy2007-12-10 19:06
错了 应该是
str=Replace(str, CHR(34), "&quot;")
#8
zmhdxy2007-12-14 10:38
str=Replace(str, CHR(34), "")
1