asp查询数据库后怎么删除空格
答案:2 悬赏:0 手机版
解决时间 2021-03-19 01:13
- 提问者网友:溺爱和你
- 2021-03-18 01:30
sql = "SELECt * FROM md5 where md5text LIKE '%"&md5text&"%' ORDER BY ID DESC"<br>rs.Open sql,conn,1,1<br>'r4=Request.QueryString("md5text")<br>If rs.EOF And rs.BOF Then <br>'r2="无结果!"<br>response.write "<script language='javascript'>"& Chr(13)<br>response.write "alert('机油!我找了N久,还是没找到。');"& Chr(13)<br> response.write "</script>" & Chr(13)<br>end if<br> 'Else<br> 'do while not rs.eof<br><br>do while not rs.eof<br>r2=rs("text")<br>r3=md5(trim(r2)) <br>%><br> <tr> <br> <td width="13%"> </td><br> <td width="22%"> <br> <div align="center">结果(<%=i%>):</div><br> </td><br> <td width="49%"> <br> <div align="center"> <br> <input size="32" name="rr2" value="<%=r2%>" ><br> </div><br> </td><br>怎么删去空格
最佳答案
- 五星知识达人网友:鱼芗
- 2021-03-18 01:52
asp去空格?
去左空格 ltrim()
去右空格 rtrim()
去空格 trim()
替换去空格 replace(String," ","")
去左空格 ltrim()
去右空格 rtrim()
去空格 trim()
替换去空格 replace(String," ","")
全部回答
- 1楼网友:春色三分
- 2021-03-18 02:13
给你一个函数:
function formatstr(string)
on error resume next
string = replace(string, chr(13), "")
string = replace(string, chr(32), " ")
string = replace(string, "", " ")
string = replace(string, "<", "lt;") '在lt前面添加“&”,百度会直接转成“<”
string = replace(string, ">", "gt;") '在gt前面添加“&”,百度会直接转成“>”
string = replace(string, chr(10) & chr(10), "<br><br>")
string = replace(string, chr(10), "<br>")
formatstr = string
end function
在从数据库读取内容的时候加上这个函数,比如:formatstr(rs("content"))。注意在textarea内不要用这个函数。
或者采用html编辑器,直接写入或读取。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯