asp教程.net 可达千百万亿 人民币小写转大写金额
///
/// 小写金额转换成大写金额
///
///
///
///
public static string converttochnmoney(decimal number, chnmoneytype turntype)
{
string s_chnnumstring = "零壹贰叁肆伍陆柒捌玖";
//可正确最大金额可以到千万亿元正,有分位为百万亿元或十万亿
string result = string.empty;
if (number > 0)
{
string s_dxdw = "分角元拾佰仟万拾佰仟亿拾佰仟万拾佰仟";
ulong je = (ulong)(number * 100);
ulong temnum = je;
int index = 0;
for (int n = 0; temnum != 0; n++)
{
index = (int)(temnum - temnum / 10 * 10); //取出最后一个数
temnum = temnum / 10;
result = s_chnnumstring.substring(index, 1) + s_dxdw.substring(n, 1) + result; //发票格式
}
if (turntype == chnmoneytype.checktype)
{
string temresult = string.empty;
string temmoney = string.empty;
string unit = string.empty;
string digitchar = string.empty;
string str1 = "零元万整";
string str2 = "零元万亿整";
for (int n = result.length - 2; n >= 0; n = n - 2) //从后面每二个取字符串。
{
temmoney = result.substring(n, 2);
unit = temmoney.substring(1, 1);
digitchar = temmoney.substring(0, 1);
switch (unit)
{
case "分":
if (digitchar == "零")
temmoney = "整";
break;
case "元":
case "万":
case "亿":
string temdigitchar = temresult.substring(0, 1);
if (digitchar == "零")
{
if (str1.indexof(temdigitchar) == -1)
temmoney = unit + "零";
else
{
if (temdigitchar == "万")
temresult = temresult.substring(1);
temmoney = unit;
}
}
else if (temdigitchar == "万")
temresult = temresult.substring(1);
break;
default:
if (digitchar == "零")
{
if (str2.indexof(temresult.substring(0, 1)) != -1)
temmoney = "";
else
temmoney = "零";
}
break;
}
temresult = temmoney + temresult;
}
result = temresult;
}
}
return result;
}
}
///
/// 大字金额的格式。
///
public enum chnmoneytype
{
///
/// 支票格式
///
checktype,
///
/// 发票格式
///
invoicetype
}
茶杯头甜蜜终章dlc 官方手机版v1.0.0.3
下载火柴人传说暗影格斗内置菜单 最新版v3.0.1
下载荒野乱斗测试服 安卓版v61.10.3
下载荒野乱斗彩虹服 安卓版v61.10.3
下载寒霜启示录 安卓版v1.25.10
寒霜启示录是一款生存模拟游戏,不少玩家可能对于末日都有着自己
末日城堡免广告版 安卓最新版v0.7.1
末日城堡免广告版是一款非常好玩的模拟经营类游戏,内部可以不看
甜蜜人生模拟器 最新版v1.4.5
甜蜜人生模拟器是一款非常好玩的模拟恋爱手游,玩家在这里能够对
武器锻造师内置功能菜单 v10.4
武器锻造师内置菜单版是游戏的破解版本,在该版本中为玩家提供了
开放空间overfield 安卓版v1.0.5
开放空间Overfield是一款箱庭养成经营手游,让你在广阔