2012年12月4日 星期二

VB.NET Unicode Big5



















--
看了一下別人的寫法,我這兒是單純化;全中文的轉換
若要完整,需再加一些英數,符號的處理

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = ""
        Dim a As String = TextBox3.Text
        Dim b As String = ""

        For i As Integer = 0 To a.Length - 1
            b = a.Substring(i, 1)
            TextBox1.Text += AscW(b).ToString
        Next

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox2.Text = ""
        For i As Integer = 0 To TextBox1.TextLength Step 5
            If i <> TextBox1.TextLength Then
                TextBox2.Text += ChrW(TextBox1.Text.Substring(i, 5))
            End If          
        Next
    End Sub
End Class

沒有留言:

張貼留言