ASP 寫的判斷 Money 各個位值的函數
發表于:2007-06-30來源:作者:點擊數:
標簽:
最近在公司做一個帳務報銷系統。 需要把一個MONEY值的個位十位百位千位還有角啊分啊的單獨取出來生成表格。 于是寫了一個得到此值的 Function ,放到這里共享。如果你看到有寫得不妥的地方,請給我來 killhand007@163.com 指正交流。 Function Moneynm(n,m) c
最近在公司做一個帳務報銷系統。
需要把一個MONEY值的個位十位百位千位還有角啊分啊的單獨取出來生成表格。
于是寫了一個得到此值的 Function ,放到這里共享。如果你看到有寫得不妥的地方,請給我來 killhand007@163.com 指正交流。
Function Moneynm(n,m)
checkPoint = InstrRev(n,".")
If n>9999.99 Then
Response.write"數據超過限制,請確定您的報銷金額在9999.99元以內!"
Else
If (checkPoint <> 0) Then
leftNum = Mid(n,1,checkPoint-1)
rightNum = Mid(n,checkPoint+1,Len(n))
Else
leftNum = n
End If
gw = Mid(leftNum,Len(leftNum),Len(leftNum))
sw = 0
bw = 0
qw = 0
jw = 0
fw = 0
If Len(leftNum)>1 Then
sw = Mid(leftNum,Len(leftNum)-1,1)
End If
If Len(leftNum)>2 Then
bw = Mid(leftNum,Len(leftNum)-2,1)
End If
If Len(leftNum)>3 Then
qw = Mid(leftNum,Len(leftNum)-3,1)
End If
If Len(rightNum)>0 Then
jw = Mid(rightNum,1,1)
End If
If Len(rightNum)>1 Then
fw = Mid(rightNum,2,1)
End If
Select case m
case "gw"
Response.Write gw
case "sw"
Response.Write sw
case "bw"
Response.Write bw
case "qw"
Response.Write qw
case "jw"
Response.Write jw
case "fw"
Response.Write fw
End Select
End If
End Function
當然在此基礎上你還可以得到萬位十萬位等。
希望對有需要的朋友有所幫助。
原文轉自:http://www.kjueaiud.com