'數字轉國字大寫 -- 精簡版
Public Class Form1
Dim i
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim s1 = "123450"
Dim r1 = "拾佰仟萬拾佰仟億拾佰仟兆"
Dim n = Len(s1)
Dim s2 = Mid(s1, n, 1)
Dim j = 1
For i = n - 1 To 1 Step -1
s2 = Mid(s1, i, 1) & Mid(r1, j, 1) & s2
j = j + 1
Next
s2 = Replace(s2, "1", "壹")
s2 = Replace(s2, "2", "貳")
s2 = Replace(s2, "3", "參")
s2 = Replace(s2, "4", "肆")
s2 = Replace(s2, "5", "伍")
s2 = Replace(s2, "6", "陸")
s2 = Replace(s2, "7", "柒")
s2 = Replace(s2, "8", "捌")
s2 = Replace(s2, "9", "玖")
s2 = Replace(s2, "0", "零")
s2 = Replace(s2, "零拾", "零")
s2 = Replace(s2, "零佰", "零")
s2 = Replace(s2, "零仟", "零")
s2 = Replace(s2, "零零零", "零")
s2 = Replace(s2, "零零", "零")
If Mid(s2, Len(s2), 1) = "零" Then s2 = Mid(s2, 1, Len(s2) - 1)
If s2 = "" Then s2 = "零"
MsgBox(s2)
End Sub
End Class
沒有留言:
張貼留言