'得到國字至兆
function getmoney(tmpstr)
strEng2Ch = "零壹貳參肆伍陸柒捌玖"
strSeqCh1 = " 拾佰仟 拾佰仟 拾佰仟 拾佰仟"
strSeqCh2 = " 萬億兆"

StrEng = CStr(CDbl(tmpstr))

intLen = Len(StrEng)
For intCounter = 1 To intLen
strTempCh = Mid(strEng2Ch, CInt(Mid(StrEng, intCounter, 1)) + 1, 1)

If strTempCh = "零" And intLen <> 1 Then
If Mid(StrEng, intCounter + 1, 1) = "0" Or (intLen - intCounter + 1) Mod 4 = 1 Then
strTempCh = ""
End If
Else
strTempCh = strTempCh & Trim(Mid(strSeqCh1, intLen - intCounter + 1, 1))
End If

If (intLen - intCounter + 1) Mod 4 = 1 Then
strTempCh = strTempCh & Mid(strSeqCh2, (intLen - intCounter + 1) \ 4 + 1, 1)
If intCounter > 3 Then
If Mid(StrEng, intCounter - 3, 4) = "0000" Then strTempCh = Left(strTempCh, Len(strTempCh) - 1)
End If
End If
strCh = strCh & Trim(strTempCh)
Next
getmoney = strCh
end function
創作者介紹
創作者 糖果的罐子 的頭像
sinyi26

糖果的罐子

sinyi26 發表在 痞客邦 留言(0) 人氣( 931 )