惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - wngwz

单点登陆 - wngwz - 博客园 IP地址 - wngwz - 博客园 简,繁体转换工具. 弹出模态窗体,关闭后。重新绑定页面(这个仅仅是对粗心大意的纪录) - wngwz - 博客园 分页存储过程 关于水晶报表的版本问题! 大年30祝大家, 不知道说还要GMail的油箱! 打印的一些知识! 求助!水晶报表! 解决把水晶报表下载到客户端过程中,出现下载整个页面(.aspx)或者直接载web页中打开word文件的问题! 收获!关于引用计数器! 把文件或图片存在数据库中! 水晶报表倒出! 关于(学习!Excel)的问题。 解决问题总结 水晶报表操作中遇到的问题 javascript 打印报表! javascript 学习
金额转换.小To大 - wngwz - 博客园
wngwz · 2006-02-08 · via 博客园 - wngwz

namespace BaseSystemFramework
{
    
using System;
    
public class Capitalization
    
{
        
public Capitalization()
        
{
        }


        
//金额数字(小写)转换成文字(大写) 
        private static string[] shuzi={"","","","","","","","","",""};
        
private static string[] danwei={"","","","","","","","","","","亿","","",""};

        
/// <summary>
        
/// 金额小写转换成大写
        
/// </summary>
        
/// <param name="payment"></param>
        
/// <returns></returns>

        public static string MoneyConvert(double payment)
        
{
            
string money;
            
int ipayment, itemp, num, length, danweinum;
            
string spayment, stemp;
            
bool yuan, wan, yi, zero;

            yi 
= false;
            wan 
= false;
            yuan 
= false;
            zero 
= false;
            money 
= "";
            ipayment 
= (int)Math.Floor(payment*100+0.5);   //转换成分并四舍五入
            if( ipayment > 0 )
            
{
                spayment 
= ipayment.ToString();    //转换成字符串
                length = spayment.Length;
                
if( length > 0 )
                
{
                    money 
= "";
                    num 
= length - 1;
                    danweinum 
= 0;
                    
while( num >= 0 )
                    
{
                        stemp 
= spayment.Substring( num, 1 );
                        itemp 
= int.Parse( stemp );
                        
if( itemp > 0 )
                        
{
                            
if( money.Length > 0 )
                            
{
                                stemp 
= shuzi[itemp] + danwei[danweinum];
                                
if( danweinum == 10 )
                                    yi 
= true;
                                
if( danweinum == 6 )
                                    wan 
= true;
                                
if( danweinum == 2 )
                                    yuan 
= true;
                                
if( danweinum > 10 )
                                    
if!yi )
                                    
{
                                        stemp 
= stemp + "亿";
                                        yi 
= true;
                                    }

                                
if( danweinum > 6 )
                                    
if!wan )
                                    
{
                                        stemp 
= stemp + "";
                                        wan 
= true;
                                    }

                                
if( danweinum > 2 )
                                    
if!yuan )
                                    
{
                                        stemp 
= stemp + "";
                                        yuan 
= true;
                                    }

                                money 
= stemp + money;
                            }

                            
else
                            
{
                                
if( danweinum > 0 )
                                
{
                                    stemp 
= shuzi[itemp] + danwei[danweinum];
                                    
if( danweinum == 10 )
                                        yi 
= true;
                                    
if( danweinum == 6 )
                                        wan 
= true;
                                    
if( danweinum == 2 )
                                        yuan 
= true;
                                    
if( danweinum > 10 )
                                        
if!yi )
                                        
{
                                            stemp 
= stemp + "亿";
                                            yi 
= true;
                                        }

                                    
if( danweinum > 6 )
                                        
if!wan )
                                        
{
                                            stemp 
= stemp + "";
                                            wan 
= true;
                                        }

                                    
if( danweinum > 2 )
                                        
if!yuan )
                                        
{
                                            stemp 
= stemp + "";
                                            yuan 
= true;
                                        }

                                    money 
= stemp + "";
                                }

                                
else
                                    money 
= shuzi[itemp] + danwei[danweinum];
                            }

                            zero 
= false;
                        }

                        
else
                        
{
                            
if( money.Length > 0 )
                                
if!zero )
                                
{
                                    money 
= shuzi[itemp] + money;
                                }

                            zero 
= true;
                        }

                        num
--;
                        danweinum
++;
                    }

                }

            }

            
return money;
        }


        
/// <summary>
        
/// 金额小写转换成大写
        
/// </summary>
        
/// <param name="payment"></param>
        
/// <returns></returns>

        public static string MoneyConvert( string payment )
        
{
            
if( payment.Length != 0)
                
return MoneyConvert( Convert.ToDouble( payment ) );
            
else
                
return MoneyConvert( Convert.ToDouble( "0" ) );
        }

    }

}