钱币数字转换为中文

public   string  NumToChs( decimal  a_money)
        
{
            
try
            
{
                
string ls_money,ls_chinese="",ls_ZF = "+";
                
int l_len,l_last,l_bit,l_bit_prior=0,l_location = 0;
                
if(a_money < 0)
                
{
                    ls_ZF 
= "-";
                    a_money 
= 0.0M - a_money;
                }

                ls_money 
= a_money.ToString("0.00");
                l_len    
= ls_money.Length;
                l_last   
= l_len -1;
                ls_money 
= ls_money.Substring(0,l_len-3)+ls_money.Substring(l_last-1,2);
                l_last  
-= 1;
                
for(int i=l_last;i>=0;i--)
                
{
                    l_location 
++;
                    l_bit 
= int.Parse(ls_money.Substring(i,1));
                    
if(l_bit==0&l_bit_prior!=0) ls_chinese = ""+ls_chinese;
                    
if(l_location==1&l_bit!=0) ls_chinese = ""+ls_chinese;
                    
if(l_location==2&l_bit!=0) ls_chinese = ""+ls_chinese;
                    
if(l_location==3) ls_chinese = ""+ls_chinese;
                    
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==0&l_bit!=0) ls_chinese = ""+ls_chinese;
                    
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==1&l_bit!=0) ls_chinese = ""+ls_chinese;
                    
if(l_location>=4&(int)SqlInt32.Mod(l_location,4)==2&l_bit!=0) ls_chinese = ""+ls_chinese;
                    
if(l_location==7|l_location==15) ls_chinese = ""+ls_chinese;
                    
if(l_location==11) ls_chinese = "亿"+ls_chinese;

                    
if(l_bit==1)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==2)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==3)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==4)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==5)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==6)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==7)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==8)  ls_chinese = ""+ls_chinese;
                    
if(l_bit==9)  ls_chinese = ""+ls_chinese;

                    l_bit_prior 
= l_bit;
                }

                
if(ls_ZF=="-") ls_chinese = "退回 "+ls_chinese;
                
return ls_chinese;
            }

            
catch(Exception ex)
            
{
                
throw new Exception(ex.Message.ToString());
            }

        }
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值