字符串中的回车问题(急!)

yewchina 2007-12-12 03:22:25
str1 = "100
456,13979,20071212151405,门口1
456,13979,20071212151405,门口2
456,13979,20071212151405,门口3
"

response.redirect ("getstr2.asp?str=" & str1)


在getstr2.asp中用
str2 = request(str)
得到的值只有100,而得不下面的几行

怎么去掉回车,使str1能像如下显示
str1 = "100 456,13979,20071212151405,门口1 456,13979,20071212151405,门口2 456,13979,20071212151405,门口3"


谢谢!
...全文
134 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
ycmuma 2007-12-13
  • 打赏
  • 举报
回复
str1=replace(str1,vbcrlf,""
)
zhitaorao 2007-12-13
  • 打赏
  • 举报
回复
UP
yewchina 2007-12-13
  • 打赏
  • 举报
回复
上面一段字符串是这样取得的

Function b2BSTR(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr (CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
b2BSTR = strReturn
End Function

Url = "http://www.abc.com/et/get.asp?from=20071111&to=20071211"
set oSend=createobject("Microsoft.XMLHTTP")
SourceCode = oSend.open ("GET",Url,false)
oSend.send()

SourceCode = b2BSTR(oSend.responseBody)
tantaiyizu 2007-12-13
  • 打赏
  • 举报
回复
楼主用 jscript 写的吧

可以用 Str1.replace("\n" ,"")
Go 旅城通票 2007-12-13
  • 打赏
  • 举报
回复
str1 = "100
456,13979,20071212151405,门口1
456,13979,20071212151405,门口2
456,13979,20071212151405,门口3
"


你这样写编译器没有报错???你这个字符串怎么来的??
yewchina 2007-12-13
  • 打赏
  • 举报
回复
是在发送前替换的,但是没效果
yewchina 2007-12-13
  • 打赏
  • 举报
回复
解决,高手多谢
Go 旅城通票 2007-12-13
  • 打赏
  • 举报
回复
'修改你的转换函数试试
Function b2BSTR(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
if MidB(vIn,i,1)<>chrb(10) and MidB(vIn,i,1)<>chrb(13) then'加个判断不为2进制回车字符时再转换
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr (CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
end if
Next
b2BSTR = strReturn
End Function
抱抱我的小猫 2007-12-13
  • 打赏
  • 举报
回复
你这个写法不报错?
yewchina 2007-12-13
  • 打赏
  • 举报
回复
str1=replace(str1,vbcrlf,"")
这个也试用,没效果
搬运工865 2007-12-12
  • 打赏
  • 举报
回复
发送之前
替换掉回车

不是接收了在替换
yewchina 2007-12-12
  • 打赏
  • 举报
回复
str1 = replace(str1,chr(13)&chr(10),"")
试了,没效果
xiaolei1982 2007-12-12
  • 打赏
  • 举报
回复
没记错的话这个也可以
str1 = replace(str1,vbcrlf,"")
lkh42002 2007-12-12
  • 打赏
  • 举报
回复
str1 = replace(str1,chr(13)&chr(10),"")
yewchina 2007-12-12
  • 打赏
  • 举报
回复
用过
for i=10 to 13
str=replace(str,chr(i),"")
next
好像没用

28,390

社区成员

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

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