如何将数字全部转换成汉字?
发布网友
发布时间:2022-04-23 03:53
我来回答
共1个回答
热心网友
时间:2022-05-03 04:21
Function strUCaseMoney(ByVal AlbMoney)
Dim strDecimal, I, J, strTemp
AlbMoney = Trim(AlbMoney & "")
I = InStr(AlbMoney, ".")
If I = 0 Then
I = Len(AlbMoney) + 1
Else
strDecimal = Mid(AlbMoney, I + 1)
End If
'转换小数点以前
strUCaseMoney = ""
J = 1
For I = I - 1 To 1 Step -1
Select Case Mid(AlbMoney, I, 1)
Case "0": strTemp = "零"
Case "1": strTemp = "壹"
Case "2": strTemp = "贰"
Case "3": strTemp = "叁"
Case "4": strTemp = "肆"
Case "5": strTemp = "伍"
Case "6": strTemp = "陆"
Case "7": strTemp = "柒"
Case "8": strTemp = "捌"
Case "9": strTemp = "玖"
End Select
'IF Int(Mid(AlbMoney,I,1))>0 Then
Select Case J
Case 1: strTemp = strTemp '& "圆"
Case 2: strTemp = strTemp & "拾"
Case 3: strTemp = strTemp & "佰"
Case 4: strTemp = strTemp & "仟"
Case 5: strTemp = strTemp & "万"
Case 6: strTemp = strTemp & "拾"
Case 7: strTemp = strTemp & "佰"
Case 8: strTemp = strTemp & "仟"
Case 9: strTemp = strTemp & "亿"
End Select
'End IF
strUCaseMoney = strTemp & strUCaseMoney
J = J + 1
Next
'转换小数
If strDecimal <> "" Then
For I = 1 To Len(strDecimal)
Select Case Mid(strDecimal, I, 1)
Case "0": strTemp = "零"
Case "1": strTemp = "壹"
Case "2": strTemp = "贰"
Case "3": strTemp = "叁"
Case "4": strTemp = "肆"
Case "5": strTemp = "伍"
Case "6": strTemp = "陆"
Case "7": strTemp = "柒"
Case "8": strTemp = "捌"
Case "9": strTemp = "玖"
End Select
Select Case I
Case 1: strTemp = strTemp & "角"
Case 2: strTemp = strTemp & "分"
Case 3: strTemp = strTemp & "厘"
'Case 4: strTemp=strTemp & ""
End Select
strUCaseMoney = strUCaseMoney & strTemp
Next
ElseIf strUCaseMoney <> "" Then
strUCaseMoney = strUCaseMoney '& "整"
End If
End Function