高分请教ASCII码串转换成字符串的asp代码
来源:百度知道 编辑:UC知道 时间:2024/05/07 04:32:15
-17494_-18693_-16938_66_68_91_-20228_-17748_-17926_-11281_-14876_-11532_93_
上面这串是用_下划连着的ASCII码串想把它转换成字符串。
转过来的是代码:
function strToAsc(strValue)
dim strTemp
dim i
strTemp=""
for i=1 to len(strValue & "")
strTemp= strTemp &asc(mid(strValue,i,1)) & "_"
next
strToAsc=strTemp
end function
现在要转回去,不知道怎么写,请 高手帮帮忙。
上面这串是用_下划连着的ASCII码串想把它转换成字符串。
转过来的是代码:
function strToAsc(strValue)
dim strTemp
dim i
strTemp=""
for i=1 to len(strValue & "")
strTemp= strTemp &asc(mid(strValue,i,1)) & "_"
next
strToAsc=strTemp
end function
现在要转回去,不知道怎么写,请 高手帮帮忙。
先用_分隔,函数用split(strTemp,"_")
然后用chr()转换回去,针对你的代码,可以如下写:
dim ThisstrTemp,ThisAr,Vstr
ThisstrTemp=strToAsc(strValue)
ThisAr=split(ThisstrTemp,"_")
for i=0 to Ubound(ThisAr)
if IsNumeric(ThisAr(i)) then
Vstr=Vstr&chr(ThisAr(i))
end if
next