放在模組裡,真他奶奶的好用呀!

Function chnumstr(num)
        numc = "零,壹,貳,參,肆,伍,陸,柒,捌,玖"
        unic = ",拾,佰,仟"
        unic1 = "元整,萬,億,兆"
        numcs = Split(numc, ",")
        unics = Split(unic, ",")
        unics1 = Split(unic1, ",")
        i = CStr(num)
        c0 = 0
        Do
            aa = 0
            j = Right(i, 4)
            c1 = 0
            s = ""
            Do
                k = j Mod 10
                If k > 0 Then
                    aa = 1
                    s = numcs(k) & unics(c1) & s
                ElseIf k = 0 Then
                    If aa = 1 Then
                        s = "零" & s
                    End If
                End If
                j = j \ 10
                c1 = c1 + 1
            Loop Until j = 0
            If (s <> "") Then
                chnumstr = s & unics1(c0) & chnumstr
            End If
            If Len(i) > 4 Then
              i = Left(i, Len(i) - 4)
            Else
              i = ""
            End If
            c0 = c0 + 1
        Loop Until i = ""
End Function
arrow
arrow
    全站熱搜

    浮雲 發表在 痞客邦 留言(3) 人氣()