VB阿拉伯数字金额转大写中文
2017-12-23 21:12
681 查看
Function mychange(ByVal Myinput)
Dim Temp, TempA, MyinputA, MyinputB, MyinputC
Dim Place As String
Dim J As Integer
Place = "分角元拾佰仟万拾佰仟亿拾佰仟万"
shuzi1 = "壹贰叁肆伍陆柒捌玖"
shuzi2 = "整零元零零零万零零零亿零零零万"
qianzhui = ""
If Val(Myinput) = 0 Then Myinput = 0
If Myinput = "" Then Myinput = 0
If Myinput < 0 Then qianzhui = "负"
Myinput = Int(Abs(Myinput) * 100 + 0.5)
If Myinput > 999999999999999# Then
mychange = "数字太大了吧???"
Exit Function
End If
If Myinput = 0 Then
mychange = "零元零分"
Exit Function
End If
MyinputA = Trim(Str(Myinput))
shuzilong = Len(MyinputA)
For J = 1 To shuzilong
MyinputB = Mid(MyinputA, J, 1) & MyinputB
Next
For J = 1 To shuzilong
Temp = Val(Mid(MyinputB, J, 1))
If Temp = 0 Then
MyinputC = Mid(shuzi2, J, 1) & MyinputC
Else
MyinputC = Mid(shuzi1, Temp, 1) & Mid(Place, J, 1) & MyinputC
End If
Next
shuzilong = Len(MyinputC)
For J = 1 To shuzilong - 1
If Mid(MyinputC, J, 1) = "零" Then
Select Case Mid(MyinputC, J + 1, 1)
Case "零", "元", "万", "亿", "整":
MyinputC = Left(MyinputC, J - 1) & Mid(MyinputC, J + 1, 30)
J = J - 1
End Select
End If
Next
shuzilong = Len(MyinputC)
For J = 1 To shuzilong - 1
If Mid(MyinputC, J, 1) = "亿" And Mid(MyinputC, J + 1, 1) = "万" Then
MyinputC = Left(MyinputC, J) & Mid(MyinputC, J + 2, 30)
Exit For
End If
Next
mychange = qianzhui & Trim(MyinputC)
End Function
Dim Temp, TempA, MyinputA, MyinputB, MyinputC
Dim Place As String
Dim J As Integer
Place = "分角元拾佰仟万拾佰仟亿拾佰仟万"
shuzi1 = "壹贰叁肆伍陆柒捌玖"
shuzi2 = "整零元零零零万零零零亿零零零万"
qianzhui = ""
If Val(Myinput) = 0 Then Myinput = 0
If Myinput = "" Then Myinput = 0
If Myinput < 0 Then qianzhui = "负"
Myinput = Int(Abs(Myinput) * 100 + 0.5)
If Myinput > 999999999999999# Then
mychange = "数字太大了吧???"
Exit Function
End If
If Myinput = 0 Then
mychange = "零元零分"
Exit Function
End If
MyinputA = Trim(Str(Myinput))
shuzilong = Len(MyinputA)
For J = 1 To shuzilong
MyinputB = Mid(MyinputA, J, 1) & MyinputB
Next
For J = 1 To shuzilong
Temp = Val(Mid(MyinputB, J, 1))
If Temp = 0 Then
MyinputC = Mid(shuzi2, J, 1) & MyinputC
Else
MyinputC = Mid(shuzi1, Temp, 1) & Mid(Place, J, 1) & MyinputC
End If
Next
shuzilong = Len(MyinputC)
For J = 1 To shuzilong - 1
If Mid(MyinputC, J, 1) = "零" Then
Select Case Mid(MyinputC, J + 1, 1)
Case "零", "元", "万", "亿", "整":
MyinputC = Left(MyinputC, J - 1) & Mid(MyinputC, J + 1, 30)
J = J - 1
End Select
End If
Next
shuzilong = Len(MyinputC)
For J = 1 To shuzilong - 1
If Mid(MyinputC, J, 1) = "亿" And Mid(MyinputC, J + 1, 1) = "万" Then
MyinputC = Left(MyinputC, J) & Mid(MyinputC, J + 2, 30)
Exit For
End If
Next
mychange = qianzhui & Trim(MyinputC)
End Function
相关文章推荐
- 货币金额阿拉伯数字转为中文大写
- php 阿拉伯数字转中文大写金额
- 金额由阿拉伯数字转换成中文大写[修改版]
- 正则也很牛,把阿拉伯数字的金额转换为中文大写数字
- C#实现阿拉伯数字(小写金额)到大写中文(大写金额)的转换
- 如何把输入的阿拉伯数字金额转换成中文大写金额
- 报表上金额由阿拉伯数字转换成中文大写
- C#阿拉伯数字金额转换为中文大写金额
- 货币金额阿拉伯数字转为中文大写
- 把阿拉伯数字的金额转换为中文大写数字
- php阿拉伯数字金额转中文大写金额
- 阿拉伯数字金额转换成中文大写
- 阿拉伯数字金额转换成中文大写(转)
- C#实现的【阿拉伯数字转换成中文大写金额】代码(原创)
- C#写的将阿拉伯数字转换成中文大写金额代码
- android 金额输入验证(阿拉伯数字转换中文大写)
- 阿拉伯数字金额转换为中文大写
- 阿拉伯数字转换成中文大写金额
- java阿拉伯数字表示的金额转换成中文大写金额
- 阿拉伯数字小写金额转换成中文大写金C额程序说明