ASP金额转人民币大写的函数

把As .....这些去掉就能在ASP里用了,网上找来的,测试可用

Public Function UMoney(ByVal money) As String
    Dim lnP As Integer
    Dim Prc As String
    Dim Tmp As String
    Dim NoB As Currency
    Dim Dx As String
    Dim Xx As String
    Dim Zhen As Boolean
    Dim China As String: China = "分角元拾佰仟万拾佰仟亿"
    Dim str: str = Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖")
    Zhen = True
    money = FormatNumber(money, 2)
    Prc = CStr(money)
    Prc = Replace(Prc, ",", "")
   
    lnP = Len(Prc)
    For i = lnP - 1 To 1 Step -1
        If Mid(Prc, i, 1) = "." Then
            Select Case lnP - i
                Case 1
                    Prc = Replace(Prc, ".", "") + "0"
                Case 2
                    Prc = Replace(Prc, ".", "")
            End Select
            Zhen = False
            Exit For
        End If
    Next
    If Zhen Then Prc = Prc + "00"
    lnP = Len(Prc)
    For i = 1 To lnP
        Tmp = str(Mid(Prc, i, 1)) & Tmp
    Next
    UMoney = ""
    fy = 1
    For i = 1 To lnP
        Xx = Mid(Tmp, i, 1)
        Dx = Mid(China, i, 1)
       
        If Xx <> "零" Then
            UMoney = Xx & Dx & UMoney
            f = 1
        Else
            If i = 3 Then
            UMoney = Dx & UMoney
            End If
       
            If i = 7 Then
                UMoney = Dx & UMoney
            End If
            If f Then
                UMoney = "零" & UMoney
            End If
            f = 0
        End If
    Next
    If Zhen Then UMoney = UMoney + "整"
    UMoney = Replace(UMoney, "零万", "万")
    UMoney = Replace(UMoney, "零元", "元")
End Function

转载于:https://www.cnblogs.com/yongzhi/articles/1187205.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值