将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分

原创 2004年07月21日 10:16:00

'将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分

Public Function Num2Chi(ByVal txtJE As Double) As String

    Dim i, K As Integer

    Dim NC, nd, ka, chrNum, strZheng As String

    Dim c1, c2, c3 As String

    Dim K1 As Integer

    Dim Zheng As String

    Dim Xiao As String

    NC = Trim(Format(txtJE, "##0.00"))

    c1 = "仟佰拾万仟佰拾亿仟佰拾万仟佰拾元"

    c2 = "角分"

    c3 = "玖捌柒陆伍肆叁贰壹"

    If NC = 0 Then

        Num2Chi = "零元整"

        Exit Function

    End If

    Num2Chi = ""

    Zheng = Mid(NC, 1, (Len(NC) - 3))

    Xiao = Mid(NC, (Len(Zheng) + 2))

    If Val(Xiao) <> 0 Then

        For i = Len(Xiao) To 1 Step -1

            chrNum = Mid(Xiao, i, 1)

            If chrNum <> 0 Then

                Num2Chi = Mid(c2, i, 1) & Num2Chi

                Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi

            End If

        Next i

    End If

 

    K = 0

    If Val(Zheng) <> 0 Then

        Num2Chi = "元" & Num2Chi

        For i = Len(Zheng) To 1 Step -1

            If (Len(Zheng) - i) = 4 Then

                Num2Chi = "万" & Num2Chi

            ElseIf (Len(Zheng) - i) = 8 Then

                Num2Chi = "亿" & Num2Chi

            ElseIf (Len(Zheng) - i) = 12 Then

                Num2Chi = "万" & Num2Chi

            End If

            chrNum = Mid(Zheng, i, 1)

            If chrNum <> 0 Then

                If i = Len(Zheng) Then

                    Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi

                Else

                    If (Len(Zheng) - i) <> 4 And (Len(Zheng) - i) <> 8 And (Len(Zheng) - i) <> 12 Then

                        Num2Chi = Mid(c1, (Len(c1) - K), 1) & Num2Chi

                    End If

                    Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi

                End If

            Else

                If Mid(Num2Chi, 1, 1) <> "元" And Mid(Num2Chi, 1, 1) <> "万" And Mid(Num2Chi, 1, 1) <> "亿" Then

                    If Mid(Num2Chi, 1, 1) <> "零" Then

                        Num2Chi = "零" & Num2Chi

                    End If

                End If

            End If

            K = K + 1

        Next i

    End If

    If Right(Trim(Num2Chi), 1) <> "分" Then

        Num2Chi = Num2Chi & "整"

    End If

End Function

 

JS将人民币小写金额转换为大写

/** 数字金额大写转换(可以处理整数,小数,负数) */ function smalltoBIG(n) { var fraction = ['角', '分']; v...
  • k8080880
  • k8080880
  • 2016-12-07 12:03:45
  • 714

用PHP实现小写金额转换大写金额【精确到分】

/** *数字金额转换成中文大写金额的函数 *String Int $num 要转换的小写数字或小写字符串 *return 大写字母 *小数位为两位 **/ function get_...
  • jucrazy
  • jucrazy
  • 2012-01-03 21:09:14
  • 4707

angularJs过滤器(货币转换,大小写,字数限制,日期)

{{price}} {{price|currency}} {{price|cu
  • u012396955
  • u012396955
  • 2017-05-31 15:41:37
  • 1693

字符串转换,大写变小写,小写变大写

String str = "ABC123abcfadfjbJBHJHJDsa";      StringBuffer sb = new StringBuffer();      int i; /...
  • ccfirstblood
  • ccfirstblood
  • 2017-05-02 18:03:31
  • 207

jquery、js 金额小写转成大写

jquery、js 金额小写转成大写,本代码完成了基本的转换,并不是最完整的,可根据需求进行修改,比如是否可以有小数点,(金额小数点也就两位,精确到分)...
  • u012402177
  • u012402177
  • 2016-07-29 11:43:25
  • 1489

num转大写中文(零壹贰叁肆伍陆柒捌玖)

package net.wendal.nutz.util; import org.junit.Test; public class MoneyLowerToUp { public String...
  • jackieriver
  • jackieriver
  • 2017-05-15 14:25:26
  • 520

js 钱大小写转换,和 数值格式化

var num=56.45678; var rs1=num.toExponential(2);//rs1的值为5.65e+1 var rs2=num.toFixed(2);//rs的值为56.45...
  • luobing_csdn
  • luobing_csdn
  • 2017-03-27 11:27:14
  • 852

C#人民币金额大写

这是一项经典编程题,笔者也曾将此题作为面试题。1.业务要求。人民币大写金额用到的汉字主要包括零、壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿等。人民币大写金额有如下注意事项:中文大写金额数字...
  • daiqianjie
  • daiqianjie
  • 2016-08-04 21:00:49
  • 1399

Delphi 12种大小写转换的方法

第一种方法有多种方法,放在下面,大家可以依次去看。好久没写笔记了。呵呵。function TPrintfrm.NumToChar(n: Real): wideString; //可以到万亿,并可随便扩...
  • zyyjc
  • zyyjc
  • 2011-03-18 09:45:00
  • 2778

数字大小写转换

数字大小写转换package com.ggy.test.demo1;import java.util.ArrayList; import java.util.HashMap; import java....
  • u013984332
  • u013984332
  • 2015-12-17 17:15:30
  • 881
收藏助手
不良信息举报
您举报文章:将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分
举报原因:
原因补充:

(最多只允许输入30个字)