<%
Function Money(thenumber)
Dim n, String1, String2, length, theDecimal, theInteger
Dim one(), onestr()
String1 = "零壹贰叁肆伍陆柒捌玖"
String2 = "万仟佰拾亿仟佰拾万仟佰拾元"
theInteger = Int(thenumber)
theDecimal = thenumber - theInteger
length = Len(theInteger)
Redim one(length-1)
Redim onestr(length-1)
For n=0 To length-1
one(n) = Mid(theInteger, n+1, 1)
one(n) = Mid(String1, one(n)+1, 1)
onestr(n) = Mid(String2, 14-length+n, 1)
one(n) = one(n) & onestr(n)
Next
Money = Replace(join(one), " ", "")
Money = Replace(Money, "零元", "元")
Money = Replace(Money, "零万", "万")
Money = Replace(Money, "零亿", "亿")
Money = Replace(Money, "零仟", "零")
Money = Replace(Money, "零佰", "零")
Money = Replace(Money, "零拾", "零")
Do While Not instr(Money, "零零") = 0
Money = Replace(Money, "零零", "零")
Loop
If theDecimal<>0 Then
theDecimal = theDecimal * 10
Money = Money & Mid(String1, Int(theDecimal)+1, 1) & "角"
theDecimal = theDecimal - Int(theDecimal)
End If
If theDecimal<>0 Then
theDecimal = theDecimal * 10
Money = Money & Mid(String1, CInt(theDecimal)+1, 1) & "分"
End If
End Function
Response.Write Money(2452835627822.26)
%>
[此贴子已经被作者于2007-10-6 5:52:56编辑过]