編碼轉換 C#中ChrW

來源:互聯網
上載者:User

''''''''''''''''''''''''''''''''
''
'내게로信用
'額度未結束
'投注

''編碼轉成中文.
''
''2006-12-22
''
''BW Wisdom
''
''QQ:214958266
''
''''''''''''''''''''''''''''''''

Public Class Code

    Public Function AsciiToString(ByVal AsciiList() As Integer) As String
        Dim i As Integer
        Dim str As String
        For i = 0 To AsciiList.Length - 1
            str += ChrW(AsciiList(i))
        Next
        Return str
    End Function
    Public Function StringToAscii(ByVal [String] As String) As Integer()
        Dim AsciiList([String].Length) As Integer
        Dim i As Integer
        For i = 0 To [String].Length - 1
            AsciiList(i) = AscW(Mid([String], i + 1, 1))
        Next
        Return AsciiList
    End Function

    Public Function ChrWChr(ByVal AsciiCode As Integer) As String
        Return ChrW(AsciiCode)
    End Function
    Public Function AscWint(ByVal [String] As String) As Integer
        Return AscW([String])
    End Function
    Public Function Test() As String
        Dim i(12) As Integer
        '내게로信用
        '額度未結束
        '投注

        i(0) = 45236
        i(1) = 44172
        i(2) = 47196
        i(3) = 20449
        i(4) = 29992
        i(5) = 38989
        i(6) = 24230
        i(7) = 26410
        i(8) = 32080
        i(9) = 26463
        i(9) = 25237
        i(9) = 27880
        Return AsciiToString(i)    ''這個Test()函數將返回:"내게로信用額度未結注"這個字串

 

    End Function
End Class
 

 

 

如果是在C#裡的話,用以下:

 

private string DeCode(string src)
        {

// 參數值src為: 額度未結束投注

//則本次解碼成為:如額度未結束投注
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HttpUtility.HtmlDecode(src, sw);
            sw.Close();
            return sb.ToString();
        }

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.