
<form name="form1" method="post" action="demo.asp">
<input type="text" name="page1num" id="page1num" value="<%=request("page1num")%>">
<input type="submit" name="button" id="button" value="提交">
</form>
<%
dim tmpnum
tmpnum=request("page1num")
response.write rmb(cdbl(tmpnum))
response.end
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 = "零壹貳叁肆伍陸柒捌玖"
rmbList = "分角元拾佰仟萬(wàn)拾佰仟億拾佰仟萬(wàn)"
If num > 9999999999999.99 Then
rmb = "超出范圍的人民幣值"
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 = "零" Then
hz = hz + CStr(n1) + CStr(n2)
Else
If n2 = "億" Or n2 = "萬(wàn)" Or n2 = "元" Or n1 = "零" Then
Do While Right(hz, 1) = "零"
hz = Left(hz, Len(hz) - 1)
Loop
End If
If (n2 = "億" Or (n2 = "萬(wàn)" And Right(hz, 1) <> "億") Or n2 = "元") Then
hz = hz + CStr(n2)
Else
If Left(Right(hz, 2), 1) = "零" Or Right(hz, 1) <> "億" Then
hz = hz + n1
End If
End If
End If
n = n + 1
Loop
Do While Right(hz, 1) = "零"
hz = Left(hz, Len(hz) - 1)
Loop
If Right(hz, 1) = "元" Then
hz = hz + "整"
End If
rmb = hz
End Function
%>
呢 稱(chēng): | |
表 情: | |
內 容: |
評論內容:不能超過(guò) 1000 字,需審核,請自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)政策法規。 |
驗證碼: | |
您發(fā)布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會(huì )、集體和公民的合法權益;
二、不得發(fā)布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發(fā)布內容擁有處置權。