ASP for case-insensitive amount conversion
<! -- # Include file = Common. asp -->
<%
Dim tmpnum
'Lower-case amount passed from the first page
Tmpnum = request ("page1num ")
'Call and display the upper-case amount
Response. Write RMB (cdbl (tmpnum ))
Response. End
%>
Common. asp
<%
Function RMB (Num)
Num = formatnumber (Num, 2)
Dim numlist
Dim rmblist
Dim numlen
Dim numchar
Dim numstr
Dim N
Dim N1, N2
Dim Hz
Numlist = "Zero errors"
Rmblist = "yuanqibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaibaiwan"
If num> 9999999999999.99 then
RMB = "RMB 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 = "" or N2 = "" or N2 = "Yuan" or n1 = "zero" then
Do While right (Hz, 1) = "0"
Hz = left (Hz, Len (HZ)-1)
Loop
End if
If (n2 = "" or (n2 = "" and Right (Hz, 1) <> "") or N2 = "") then
Hz = Hz + CSTR (N2)
Else
If left (right (Hz, 2), 1) = "zero" or right (Hz, 1) <> "" then
Hz = Hz + N1
End if
End if
End if
N = n + 1
Loop
Do While right (Hz, 1) = "0"
Hz = left (Hz, Len (HZ)-1)
Loop
If right (Hz, 1) = "Yuan" then
Hz = Hz + "whole"
End if
RMB = Hz
End Function
%>
This version solves the problem that decimal points cannot be reached. The processing method conforms to the accounting method!