关于存储的格式问题,请个位赐教!

qiu_sj 2003-05-29 08:43:46
我将text中的内容存到数据库中,但我想连格式也存起来!
当从数据库中读出显示到 text上 或<TR>中 还是那个格式
比如我输入! 你好!
好想你
读出显示也应该是这样!
这样的代码应该怎么写!
...全文
21 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
肄若芸 2003-05-29
  • 打赏
  • 举报
回复
replace快
linuxsun999 2003-05-29
  • 打赏
  • 举报
回复
function htmlencode(str)
dim result
dim l

if isNULL(str) then
htmlencode=""
exit function
end if
l=len(str)

result=""
dim i

for i = 1 to l
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(13)
result=result+"<br>"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(32)
result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case chr(9)
result=result+" "
case else
result=result+mid(str,i,1)
end select
next
htmlencode=result
end function
肄若芸 2003-05-29
  • 打赏
  • 举报
回复
function HTMLEncode(fString)
if not isnull(fString) then

fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")

HTMLEncode = fString
end if
end function
chinahuman 2003-05-29
  • 打赏
  • 举报
回复
可以用replace来呀!
比如用:replace(strget,chr(13),"<br>")这样来完成替换回车
qiu_sj 2003-05-29
  • 打赏
  • 举报
回复
请大家帮帮我1

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧