二进制连接函数VBSCRIPT

发表于:2007-05-25来源:作者:点击数: 标签:publicVBScript连接二进制函数

Public Function ConvertAsc(strIn)
 Dim i
 ConvertAsc = ""
 For i=1 to Len(strIn)
  Dim c: c = Asc(Mid(strIn, i, 1))
  If Abs(c)<128 Then
   ConvertAsc = ConvertAsc & ChrB(c)
  Else
   Dim h: h = Hex(c)
   ConvertAsc = ConvertAsc & ChrB(Int("&H" & Mid(h, 1, 2)))
   ConvertAsc = ConvertAsc & ChrB(Int("&H" & Mid(h, 3, 2)))
  End If
 Next
End Function

Dim a: a = ConvertAsc("hello world!")
Dim b: b = ConvertAsc("世界你好!")

Response.BinaryWrite a + b

原文转自:http://www.ltesting.net