二进制连接函数VBSCRIPT

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

你可能感兴趣的:(c,function,VBScript,hex)