The first method is that this program can convert currency amounts of less than one trillion yuan (it's enough), and both Chinese characters and numbers are calculated as one:
Function AtoC(a As Currency) As String
' Define two strings,AThe value is at most two decimal places.
Dim String1 As String
' Definition as follows.
Dim String2 As String
' Definition as follows.
Dim String3 As String
' FromAThe value taken out of the value.
Dim I As Integer
' Loop variables.
Dim J As Integer
' AMultiply the value of100string length.
Dim Ch1 As String
' Chinese reading of numbers.
Dim Ch2 As String
' Chinese characters pronunciation of numerical digits.
Dim nZero As Integer
' How many consecutive non-zero numbers are used to calculate.
String1 = "Zero One Two Three Si Wu Lu Qi Eight Nine"
String2 = "Wan Qianqian pick up billions of thousands of thousands of thousands of thousands of cents of cents of cents"
'MsgBox CStr(a * 100)
If InStr(1, CStr(a * 100), ".") <> 0 Then
5000, , "This function( AtoC() )Convert only values within two decimal places!"
End If
J = Len(CStr(a * 100))
String2 = Right(String2, J)
' Take out the corresponding number of digitsStrING2Value of.
For I = 1 To J
String3 = Mid(a * 100, I, 1)
' Take out the value of a certain bit to be converted.
If String3 <> "0" Then
Ch1 = Mid(String1, Val(String3) + 1, 1)
Ch2 = Mid(String2, I, 1)
nZero = nZero + 1
' Indicates that the base is not zero.
Else
If nZero <> 0 Or I = J - 9 Or I = J - 5 Or I = J - 1 Then
If Right(AtoC, 1) = "zero" Then AtoC = Left(AtoC, Len(AtoC) - 1)
Ch1 = "zero"
Else
Ch1 = ""
End If
If I = J - 10 Then
' If the converted value needs to be expanded, change the following expression I Value of.
Ch2 = "100 million"
ElseIf I = J - 6 Then
If nZero <> 0 Then
Ch2 = "Ten thousand"
' nZero = 0
End If
ElseIf I = J - 2 Then
Ch2 = "Yuan"
ElseIf I = J Then
Ch2 = "all"
Else
Ch2 = ""
End If
nZero = 0
End If
AtoC = AtoC & Ch1 & Ch2
Next I
AtoC = Replace(AtoC, "Zero yuan", "Yuan")
AtoC = Replace(AtoC, "Zero ten thousand", "Ten thousand")
AtoC = Replace(AtoC, "Zero Billion", "100 million")
AtoC = Replace(AtoC, "Partial", "all")
' The above removes the excess zero
End Function
The second method: just write it as follows!
<%
dim str(9)
str(0)="zero"
str(1)="one"
str(2)="two"
str(3)="3"
str(4)="born"
str(5)="Wu"
str(6)="land"
str(7)="Seven"
str(8)="eight"
str(9)="Nine"
aa=("source")
hh=formatnumber(aa,2,-1)
aa=replace(hh,".","")
aa=replace(aa,",","")
for i=1 to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: k= mynum&"point"
case 2: k= mynum&"horn"
case 3: k= mynum&"Yuan"
case 4: k= mynum&"pickup"
case 5: k= mynum&"Bai"
case 6: k= mynum&"thousand"
case 7: k= mynum&"Ten thousand"
case 8: k= mynum&"pickup"
case 9: k= mynum&"Bai"
case 10: k= mynum&"thousand"
end select
m=m&k
next
%>
<html>
<head>
<title>Wonderful Spring Breeze: Digital Case Conversion</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<!--
Elseif(s=".") then
n=m
i=i+2
for j=i to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: p= mynum&"point"
case 2: p= mynum&"horn"
end select
m=m&p
next
-->
<body>
<form method="post" name="forma">
<input type="text" name="source" value="<%=hh%>">
=
<input type="text" name="result" value="<%=m%>" size="40">
<input type="submit" name="Submit" value="Start the conversion" >
</form>
</body></html>