。吐血啊为什么每次都是打了好多字就找到问题了,上面写的时候都知道要加\x,后面居然没加斜杆,浪费我一个小时啊!

解决方案 »

  1.   

    一个半角=>全角的函数,仅限于chr(33)-chr(126),vbs版
    效率不是很高,reg对象的replace方法使用反相引用的结果不能放到函数里(造诣不高),我这里就用了execute<SCRIPT LANGUAGE="VbScript">
    str = "1新浪网!@#程序员_+}{:><"
    alert str&vbcrlf&b2s(str)function b2s(strng)
    Dim regEx,Matches,Match
    Set regEx = New regExp
    regEx.Pattern = "[\x21-\x7e]"
    regEx.IgnoreCase = False
    regEx.Global = True
    Set Matches = regEx.Execute(strng)
    For Each Match In Matches
    strng = replace(strng,Match.value,chrw(asc(Match.value)+65248))
    Next
    Set Matches = nothing
    Set regEx = nothing
    b2s = strng
    end function
    </SCRIPT>