大超博客

属于自己和家人的一片宁静~

转换16进制
大超 | 2008-04-24 13:06:52 | 1104 点击 | 0 评论
  1. <%Public Function URLEncoding(v,f)  
  2. Dim s,t,i,j,h,l,x : s = "" : x=Len(v)  
  3. For i = 1 To x  
  4. t = Mid(v,i,1) : j = Asc(t)  
  5. If (j>=48 And j<=57) Or (j>=65 And j<=90) Or (j>=97 And j<=122) Then 
  6. If f Then 
  7. s = s & "%" & Right("00" & Hex(j),2)  
  8. Else 
  9. s = s & t  
  10. End If 
  11. ElseIf j<0 Then 
  12. j = j + &H10000  
  13. h = (j And &HFF00) \ &HFF  
  14. l = j And &HFF  
  15. s = s & "%" & Right("00" & Hex(h),2) & "%" & Right("00" & Hex(l),2)  
  16. Else 
  17. s = s & "%" & Right("00" & Hex(j),2)  
  18. End If 
  19. Next 
  20. URLEncoding = s  
  21. End Function 
  22. response.write URLEncoding("hezu123.com",1)  
  23. %> 
标签:

16进制

引用通告:http://www.niuchao.com/Article/15/Trackback.ashx
暂时没有评论
(必填)
(必填,不会被公开)
你可以在 30 分钟内修改你所发表的评论

Powered by Bitrac v1.13.