Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim strInput As String = TextBox1.Text
Dim ArrInput As Char() = strInput.ToCharArray()
Dim i As Integer
For i = 0 To ArrInput.Length - 1
Select Case ArrInput(0)
Case "0" : TextBox2.Text = "ศูนย์"
Case "1" : TextBox2.Text = "หนึ่ง"
Case "2" : TextBox2.Text = "สอง"
Case "3" : TextBox2.Text = "สาม"
Case "4" : TextBox2.Text = "สี่"
Case "5" : TextBox2.Text = "ห้า"
Case "6" : TextBox2.Text = "หก"
Case "7" : TextBox2.Text = "เจ็ด"
Case "8" : TextBox2.Text = "เป็ด"
Case "9" : TextBox2.Text = "เก้า"
Case "A", "a" : TextBox2.Text = "เอ"
End Select
Next
End Sub
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ArrInput As Char() = TextBox1.Text
Dim i As Integer
Dim ArrOutput(100)
For i = 0 To ArrInput.Length - 1
Select Case ArrInput(i)
Case "0" : ArrOutput(i) = "๐"
Case "1" : ArrOutput(i) = "๑"
Case "2" : ArrOutput(i) = "๒"
Case "3" : ArrOutput(i) = "๓"
Case "4" : ArrOutput(i) = "๔"
Case "5" : ArrOutput(i) = "๕"
Case "6" : ArrOutput(i) = "๖"
Case "7" : ArrOutput(i) = "๗"
Case "8" : ArrOutput(i) = "๘"
Case "9" : ArrOutput(i) = "๙"
Case "A", "a" : ArrOutput(i) = "เอ"
Case "B", "b" : ArrOutput(i) = "บี"
Case "C", "c" : ArrOutput(i) = "ซี"
Case "D", "d" : ArrOutput(i) = "ดี"
Case "E", "e" : ArrOutput(i) = "อี"
Case "F", "f" : ArrOutput(i) = "เอฟ"
Case "G", "g" : ArrOutput(i) = "จี"
Case Else : ArrOutput(i) = "*"
End Select
TextBox2.Text = ArrOutput(0) + ArrOutput(1) + ArrOutput(2) + ArrOutput(3) + ArrOutput(4) + ArrOutput(5) + ArrOutput(6) + ArrOutput(7) + ArrOutput(8) + ArrOutput(9) + ArrOutput(10)
Next
End Sub
End Class
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ArrInput As Char() = TextBox1.Text
Dim i As Integer
Dim ArrOutput(100)
For i = 0 To ArrInput.Length - 1
Select Case ArrInput(i)
Case "0" : ArrOutput(i) = "๐"
Case "1" : ArrOutput(i) = "๑"
Case "2" : ArrOutput(i) = "๒"
Case "3" : ArrOutput(i) = "๓"
Case "4" : ArrOutput(i) = "๔"
Case "5" : ArrOutput(i) = "๕"
Case "6" : ArrOutput(i) = "๖"
Case "7" : ArrOutput(i) = "๗"
Case "8" : ArrOutput(i) = "๘"
Case "9" : ArrOutput(i) = "๙"
Case "A", "a" : ArrOutput(i) = "เอ"
Case "B", "b" : ArrOutput(i) = "บี"
Case "C", "c" : ArrOutput(i) = "ซี"
Case "D", "d" : ArrOutput(i) = "ดี"
Case "E", "e" : ArrOutput(i) = "อี"
Case "F", "f" : ArrOutput(i) = "เอฟ"
Case "G", "g" : ArrOutput(i) = "จี"
Case Else : ArrOutput(i) = "*"
End Select
Next
TextBox2.Text = String.Join("", ArrOutput)
End Sub
End Class
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xxx = New RegularExpressions.Regex("[0-9a-z]").Replace("987aaa", New RegularExpressions.MatchEvaluator(AddressOf yyy))
'ผลลัพธ์ ๙๘๗อ้าอ้าอ้า
End Sub
Private Function yyy(ByVal m As RegularExpressions.Match) As String
Dim strArr() As String = {"๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙", "อ้า", "ขา"}
Dim result As string = strArr(If(m.Value = "a", 10, m.Value))
Return result
End Function
End Class
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xxx = New RegularExpressions.Regex("[0-9a-z]").Replace("987aaa", New RegularExpressions.MatchEvaluator(Function(m) {"๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙", "อ้า", "ขา"}(If(m.Value = "a", 10, m.Value))))
'ผลลัพธ์ ๙๘๗อ้าอ้าอ้า
End Sub
End Class
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xxx = New RegularExpressions.Regex("[0-9a-c]").Replace("987azbc", New RegularExpressions.MatchEvaluator(Function(m) {"๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙", "อ้า", "ขา", "ให้ดูหน่อยซิ"}(If(Regex.IsMatch(m.Value, "[a-z]"), Asc(m.Value) - 87, m.Value))))
'ผลลัพธ์ ๙๘๗อ้าzขาให้ดูหน่อยซิ
End Sub
End Class
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xxx = New RegularExpressions.Regex("[0-9a-c]").Replace("987azbc", New RegularExpressions.MatchEvaluator(Function(m) {"๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙", "อ้า", "ขา", "ให้ดูหน่อยซิ"}(If(Regex.IsMatch(m.Value, "[a-z]"), Asc(m.Value) - 87, m.Value))))
'ผลลัพธ์ ๙๘๗อ้าzขาให้ดูหน่อยซิ
End Sub
End Class