Function VbsUnEscape(str)
                    Dim x
        x=InStr(str,"%") 
        Do While x>0
            VbsUnEscape=VbsUnEscape&Mid(str,1,x-1)
            If LCase(Mid(str,x+1,1))="u" Then
                VbsUnEscape=VbsUnEscape&ChrW(CLng("&H"&Mid(str,x+2,4)))
                str=Mid(str,x+6)
            Else
                VbsUnEscape=VbsUnEscape&Chr(CLng("&H"&Mid(str,x+1,2)))
                str=Mid(str,x+3)
            End If
            x=InStr(str,"%")
        Loop
        VbsUnEscape=VbsUnEscape&str
    End Function以上函数用在asp中 如何改成在C#中使用?

解决方案 »

  1.   

    高手帮忙看看
    高手帮忙看看
    高手帮忙看看
    我的改法 但是不行
    public void VbsUnEscape( str)
            {
                var x;
                x = IndexOf(str,"%");
                do
                {
                    VbsUnEscape =VbsUnEscape+Substring(str,1,x-1);
                    if(ToLower(Substring(str,x+1,1))="u") 
                    {
                        VbsUnEscape =VbsUnEscape+Convert.ToChar(Convert.ToInt64("+H"+Substring(str,x+2,4)));
                        str=Substring(str,x+6);
                    }
                    else
                    {
                        VbsUnEscape =VbsUnEscape+Convert.ToChar(Convert.ToInt64("+H"+Substring(str,x+1,2)));
                        str=Substring(str,x+3);
                    }
                    x=IndexOf(str,"%");
                 
                }
                while(x>0);
                VbsUnEscape=VbsUnEscape+str;
                
            }