<!--#include file=common.asp-->
<%
dim tmpnum
'The lowercase amount passed from the first page
tmpnum=request("page1num")
'Call and display the amount in uppercase
response.write rmb(cdbl(tmpnum))
response.end
%>
common.asp
<%
Function rmb(num)
num = FormatNumber(num, 2)
DimnumList
Dim rmbList
DimnumLen
Dim numChar
Dim numstr
Dim n
Dim n1, n2
wxya
numList = "Zero, one, two, three, four, five, six, eight, nine"
rmbList = "cents of cents one hundred million one hundred million one hundred million"
If num > 9999999999999.99 Then
rmb = "RMB value out of range"
Exit Function
End If
numstr = CStr(num * 100)
numLen = Len(numstr)
n=1
Do While n <= numLen
numChar = CInt(Mid(numstr, n, 1))
n1 = Mid(numList, numChar + 1, 1)
n2 = Mid(rmbList, numLen - n + 1, 1)
If Not n1 = "zero" Then
hz = hz + CStr(n1) + CStr(n2)
Else
If n2 = "100 million" Or n2 = "10,000" Or n2 = "Yuan" Or n1 = "0" Then
Do While Right(hz, 1) = "zero"
hz = Left(hz, Len(hz) - 1)
Loop
End If
If (n2 = "100 million" Or (n2 = "10,000" And Right(hz, 1) <> "100 million") Or n2 = "100 million") Then
hz = hz + CStr(n2)
Else
If Left(Right(hz, 2), 1) = "zero" Or Right(hz, 1) <> "100 million" Then
hz = hz + n1
End If
End If
End If
n = n + 1
Loop
Do While Right(hz, 1) = "zero"
hz = Left(hz, Len(hz) - 1)
Loop
If Right(hz, 1) = "元" Then
hz = hz + "whole"
End If
rmb=hz
End Function
%>
This version solves the problem of missing decimal places, and the processing method is consistent with accounting methods!