金额数字(小写)转换成文字(大写)
来源:互联网 发布:h3c防火墙web端口登录 编辑:程序博客网 时间:2024/04/30 10:31
private static string[] shuzi={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
private static string[] danwei={"分","角","元","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟"};
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;
}
- 金额数字(小写)转换成文字(大写)
- 大写金额转换小写数字金额(美图2017线下笔试题)
- 小写金额转换为大写金额(vb2010)
- Java小写金额转换大写与金额比对(支持繁体大写金额)
- 将小写数字金额转换为大写得金额
- JavaCodeUtil(数字金额大写转换)
- 小写数字金额转大写
- 小写数字金额,转换成大写中文,绝无错误
- 大写金额转换成小写
- 小写金额转换成大写
- 小写金额转换成大写
- 小写金额转换为大写
- 小写金额转换成大写
- 小写金额转换成大写
- 小写金额转换成大写
- 小写金额转换为大写
- js小写金额转换大写
- 将小写数字金额转成大写金额
- 为什么Runtime.exec("ls")没有任何输出?
- 如何产生签名applet,以使applet能够访问本地资源?
- 多分支树的类模块(原创)
- 二叉树类模块(原创)
- 网站测试技术介绍
- 金额数字(小写)转换成文字(大写)
- Google的秘密通道
- 增值平台已经初见成效了。
- hibernate高级特性_1
- Struts + Hibernate分页显示 v1.0
- IT从业人员必看的10个论坛
- 采用神经网络进行城市中长期负荷预测的一种信息系统
- DOS下把.vb编译成.dll的
- SQL SERVER ODBC 出错