写了个人民币转中文大写的函数,但解决不了双零多零问题!!!
<%
Function MONEYtoCHINESE (getMoney)
'判断是不是数字类型
If IsNumeric(getMoney) Then
'将getMoney格式化成000.00形式
If InStr(getMoney,".") > 0 Then
beforePoint = Left(getMoney,InStr(getMoney,".") - 1)
afterPoint = Right(getMoney,Len(getMoney) - InStr(getMoney,"."))
If Len(afterPoint) = 1 Then
afterPoint = afterPoint & "0"
End If
getMoney = beforePoint & "." & afterPoint
Else
getMoney = getMoney & ".00"
End If
str1 = "仟佰拾億仟佰拾萬仟佰拾元p角分"
str2 = "1234567890"
str3 = "壹贰叁肆伍陆柒捌玖零"
str1 = Right(str1,Len(getMoney))
For i =1 To Len(getMoney)
outstr = outstr & Right(Left(getMoney,i),1) & Right(Left(str1,i),1)
Next
For i = 1 To 10
outstr = Replace(outstr,Mid(str2,i,1),Mid(str3,i,1))
Next
outstr = Replace(outstr,".p","")
Response.Write outstr : response.end
outstr = Replace(outstr,"零仟","")
outstr = Replace(outstr,"零佰","零")
outstr = Replace(outstr,"零拾","零")
outstr = Replace(outstr,"零元","零")
outstr = Replace(outstr,"零角","零")
outstr = Replace(outstr,"零分","")
getMoney = outstr
Response.Write getMoney
Else
Response.Write "你输入的不是数字类型,无法转换!"
End If
End Function
MONEYtoCHINESE(1123321.32)
%>