日期:2014-05-17  浏览次数:21014 次

字符串处理(将<br>转换为回车符),急!
我的代码如下:
function   convert(str)
if   str <> " "   then
str=replace(str,chr(13), " <br> ")
str=replace(str,chr(32), "&nbsp; ")
end   if
convert=str
end   function
function   reconvert(str)
        ON   ERROR   RESUME   NEXT
if   str <> " "   then
str=replace(str, " <br> ",chr(13))
str=replace(str, "&nbsp; ",chr(32))
end   if
reconvert=str
end   function
其中convert函数运行正常,但是reconvert函数不能正常工作, <br> 不能够实现换行操作,不知道为什么?

------解决方案--------------------
没有问题,look
--------------------------
<%

function reconvert(str)
ON ERROR RESUME NEXT
if str <> " " then
str=replace(str, " <br> ",chr(13))
str=replace(str, "&nbsp; ",chr(32))
end if
reconvert=str
end function

str = "asdfasdf <br> 123 "
Response.write " <textarea> " & reconvert(str) & " </textarea> "
%>
------解决方案--------------------
<%
str = "asdfasdf <br> 123 "
Response.Write str
%>

看到的效果就是:
asdfasdf
123