# （原创）金额数值小写转大写函数

<%
Response.Write(ChangeMoney(235))

Function ChangeMoney(sMoney)
On Error Resume Next
Dim sTo
Dim iInt,iMod
'取得整数
sMoney=sMoney / 1
If Err.Number<>0 Then
Response.Write "数值太大!!不能转换!!"
Response.End
End If
iInt=Len(sMoney)
If iInt>5 Then    '超过万
iMod=iInt-4
sTo=ChangeTo(sMoney,iMod,1)
iMod=4
sTo=sTo&"万"
sTo=sTo&ChangeTo(sMoney,iMod,0)&"元整"
Else
sTo=ChangeTo(sMoney,iInt,0)&"元整"
End iF
ChangeMoney=sTo
End Function

Function ChangeTo(sMoney,iNum,iTo)
Dim sTr
Do While iNum>0
sTr=sTr&GetMoney(sMoney,iNum,iTo)
iNum=iNum-1
Loop
ChangeTo=sTr
End Function

Function GetMoney(sMoney,iNum,iTo)
Dim sMen,sStr,iLen
iLen=Len(sMoney)-(iNum+iTo*5)+1+iTo
sMen="零壹贰叄肆伍陆柒捌玖"
Select Case iNum
Case 5
If iTo=1 Then
sStr="亿"
Else
sStr="万"
End If
Case 4
sStr="千"
Case 3
sStr="百"
Case 2
sStr="十"
Case else
sStr=""
End Select
GetMoney=Mid(sMen,Cint(Mid(sMoney,iLen,1))+1,1)&sStr
End Function
%>

<%
Response.Write(ChangeMoney(2032400))

Function ChangeMoney(sMoney)
On Error Resume Next
Dim sTo
Dim iInt,iMod
'取得整数
sMoney=sMoney / 1
If Err.Number<>0 Then
Response.Write "数值太大!!不能转换!!"
Response.End
End If
If Left(sMoney,1)="0" Then
Response.Write "输入错误的数值!开头不能是0!"
Response.End
End If
iInt=Len(sMoney)
If iInt>5 Then    '超过万
iMod=iInt-4
sTo=ChangeTo(sMoney,iMod,1)
iMod=4
sTo=sTo&"万"
sTo=sTo&ChangeTo(sMoney,iMod,0)&"元整"
Else
sTo=ChangeTo(sMoney,iInt,0)&"元整"
End iF
ChangeMoney=sTo
End Function

Function ChangeTo(sMoney,iNum,iTo)
Dim sTr
Do While iNum>0
sTr=sTr&GetMoney(sMoney,iNum,iTo)
iNum=iNum-1
Loop
ChangeTo=sTr
End Function

Function GetMoney(sMoney,iNum,iTo)
Dim sMen,sStr,iLen,sNum,sVal
iLen=Len(sMoney)-(iNum+iTo*5)+1+iTo
sMen="零壹贰叄肆伍陆柒捌玖"
sVal=" 十百千万"
sStr=Mid(sVal,iNum,1)
If iNum=5 And iTo=1 Then   '亿
sStr="亿"
End If
sNum=Mid(sMoney,iLen,1)
If sNum<>"0" Then
GetMoney=Mid(sMen,Cint(sNum)+1,1)&trim(sStr)
Else
GetMoney=""
End If
End Function
%>