คำตอบที่ได้รับเลือกจากเจ้าของกระทู้
ความคิดเห็นที่ 3

Function ctext(v As String) As String
Dim i, j As Integer
Dim sourcedata As String
Dim arr() As String
Dim element() As String
Dim d() As String
sourcedata = "A,เอ;B,บี;C,ซี;D,ดี;E,อี;F,เอฟ;G,จี;H,เอช;I,ไอ;J,เจ;K,เค;L,แอล;M,เอ็ม;N,เอ็น;O,โอ;P,พี;Q,คิว;R,อาร์;S,เอส;" & _
"T,ที;U,ยู;V,วี;W,ดับเบิ้ลยู;X,เอ็กซ์;Y,วาย;Z,แซด;a,เอ;b,บี;c,ซี;d,ดี;e,อี;f,เอฟ;g,จี;h,เอช;i,ไอ;j,เจ;k,เค;l,แอล;" & _
"m,เอ็ม;n,เอ็น;o,โอ;p,พี;q,คิว;r,อาร์;s,เอส;t,ที;u,ยู;v,วี;w,ดับเบิ้ลยู;x,เอ็กซ์;y,วาย;z,แซด;1,หนึ่ง;2,สอง;3,สาม;4,สี่;5,ห้า;6,หก;7,เจ็ด;8,แปด;9,เก้า;0,ศูนย์"
arr = Split(sourcedata, ";")
Set dict = New Scripting.Dictionary
For i = 0 To UBound(arr)
element = Split(arr(i), ",")
If Not dict.Exists(element(0)) Then
dict.Add element(0), element(1)
End If
Next i
For i = 1 To Len(v)
ReDim Preserve d(i) As String
mChr = Mid(v, i, 1)
For Each varKey In dict.Keys
If mChr = varKey Then
d(i) = dict.Item(varKey)
End If
Next
Next i
For i = 1 To UBound(d)
If i <> UBound(d) Then
Debug.Print d(i)
result = result & d(i) & "-"
Else
Debug.Print d(i)
result = result & d(i)
End If
Next i
ctext = result
End Function

Function ctext(v As String) As String
Dim i, j As Integer
Dim sourcedata As String
Dim arr() As String
Dim element() As String
Dim d() As String
sourcedata = "A,เอ;B,บี;C,ซี;D,ดี;E,อี;F,เอฟ;G,จี;H,เอช;I,ไอ;J,เจ;K,เค;L,แอล;M,เอ็ม;N,เอ็น;O,โอ;P,พี;Q,คิว;R,อาร์;S,เอส;" & _
"T,ที;U,ยู;V,วี;W,ดับเบิ้ลยู;X,เอ็กซ์;Y,วาย;Z,แซด;a,เอ;b,บี;c,ซี;d,ดี;e,อี;f,เอฟ;g,จี;h,เอช;i,ไอ;j,เจ;k,เค;l,แอล;" & _
"m,เอ็ม;n,เอ็น;o,โอ;p,พี;q,คิว;r,อาร์;s,เอส;t,ที;u,ยู;v,วี;w,ดับเบิ้ลยู;x,เอ็กซ์;y,วาย;z,แซด;1,หนึ่ง;2,สอง;3,สาม;4,สี่;5,ห้า;6,หก;7,เจ็ด;8,แปด;9,เก้า;0,ศูนย์"
arr = Split(sourcedata, ";")
Set dict = New Scripting.Dictionary
For i = 0 To UBound(arr)
element = Split(arr(i), ",")
If Not dict.Exists(element(0)) Then
dict.Add element(0), element(1)
End If
Next i
For i = 1 To Len(v)
ReDim Preserve d(i) As String
mChr = Mid(v, i, 1)
For Each varKey In dict.Keys
If mChr = varKey Then
d(i) = dict.Item(varKey)
End If
Next
Next i
For i = 1 To UBound(d)
If i <> UBound(d) Then
Debug.Print d(i)
result = result & d(i) & "-"
Else
Debug.Print d(i)
result = result & d(i)
End If
Next i
ctext = result
End Function
▼ กำลังโหลดข้อมูล... ▼
แสดงความคิดเห็น
คุณสามารถแสดงความคิดเห็นกับกระทู้นี้ได้ด้วยการเข้าสู่ระบบ
มี web app หรือสูตร excel ที่แปลงข้อความ เช่น 2gocTx5u แปลงออกมาเป็น สอง จี โอ ซี ที เอ็กซ์ ห้า ยู
โดยที่จะไม่เป็นแบบนี้ เช่น 12 หรือ we จะไม่อ่านเป็น สิบสอง หรือ วี
มันมีไหมครับ
--- ขอบคุณครับ