网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 设计资源 > .Net编程 > 正文

数字转人民币大写的方法

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务

 

private   string   GetNumToUpper(decimal   Money)  
                {  
                        
                        string   NumList   =   "";   string   RmbList   =   "";  
                        int   NumLen   =   0;   int   NumChar   =   0;  
                        string   N1   =   "",   N2   =   "";  
                        decimal   Mnu   =   0;  
                        int   I   =   0;  
                        string   numStr   =   "";string   Change   =   "";  

                        Mnu   =   Money;  
                        if   (Money   >   0)  
                        {  
                                Money   =   Convert.ToDecimal(Money.ToString("#.00"));  
                        }
  
                        else  
                        {  
                                Money   =   Convert.ToDecimal(Money.ToString("#.00"))   *   -1;  
                        }
  

                        NumList   =   "零壹贰叁肆伍陆柒捌玖";  
                        RmbList   =   "分角元拾佰仟万拾佰仟亿拾佰仟万";  

                        if   (Money   >   9999999999999.99M)  
                        {  
                                return   "-------";     //超出范围的人民币值,无法显示!;  
                        }
  

                        numStr   =   Convert.ToString(Convert.ToDecimal(Money   *   100).ToString("#"));  
                        NumLen   =   numStr.Length;  

                        I   =   0;  
                        while   (I   <=   NumLen   -1)  
                        {  
                                NumChar   =   Convert.ToInt32(numStr.Substring(I,   1));  
                                N1   =   NumList.Substring(NumChar,   1);  
                                N2   =   RmbList.Substring(NumLen   -   I   -1,   1);  
                                if   (N1   !=   "零")  
                                {  
                                        Change   +=   N1   +   N2;  
                                }
  
                                else  
                                {  
                                        if   (N2   ==   "亿"   ¦ ¦   N2   ==   "万"   ¦ ¦   N2   ==   "元"   ¦ ¦   N1   ==   "零")  
                                        {  
                                                while   (Change.Substring(Change.Length   -   1,   1)   ==   "零")  
                                                {  
                                                        Change   =   Change.Substring(0,   Change.Length   -   1);  
                                                }
  
                                        }
  
                                        if   (N2   ==   "亿"   ¦ ¦   (N2   ==   "万"   &&   Change.Substring(Change.Length   -   1,   1)   !=   "亿")   ¦ ¦   N2   ==   "元")  
                                        {  
                                                Change   +=   N2;  
                                        }
  
                                        else  
                                        {  
                                                if   (Change.Substring(Change.Length   -   2,   2).Substring(0,   1)   ==   "零"   ¦ ¦   Change.Substring(Change.Length   -   1,   1)   !=   "亿")  
                                                {  
                                                        Change   +=   N1;  
                                                }
  
                                        }
  
                                }
  
                                I++;  
                        }
  
                        if   (Change.Length   >   1)  
                        {  
                                while   (Change.Substring(Change.Length   -   1,   1)   ==   "零")  
                                {  
                                        Change   =   Change.Substring(0,   Change.Length   -   1);  
                                }
  
                                if   (Change.Substring(Change.Length   -   1,   1)   ==   "元"   ¦ ¦   Change.Substring(Change.Length   -   1,   1)   ==   "角")  
                                {  
                                        Change   +=   "整";  
                                }
  
                        }
  
                        
                                              
                        if   (Mnu   >   0)  
                        {  
                                return   Change;  
                        }
  
                        else   if   (Mnu   <   0)  
                        {  
                                return   "负"   +   Change;  
                        }
  
                        else  
                        {  
                                return   "零元整";  
                        }
    
                }

 

设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师