C# 钱数换算成大写方法

public static string getUpperMoney(string money)
{
String[] Scale = { "分", "角", "元", "拾",
"佰", "仟", "万", "拾", "佰", "仟", "亿", "拾",
"佰", "仟", "兆", "拾", "佰", "仟" };

String[] Base = { "零", "壹", "贰", "叁",
"肆", "伍", "陆", "柒", "捌", "玖" };

String Temp = money;
String Info = null;
int index = Temp.IndexOf(".", 0, Temp.Length);//判断是否有小数点
#region
if (index != -1)
{
Temp = Temp.Remove(Temp.IndexOf("."), 1);
for (int i = Temp.Length; i > 0; i--)
{
int Data = Convert.ToInt16(Temp[Temp.Length - i]);
Info += Base[Data - 48];
Info += Scale[i - 1];
}
}
#endregion
#region
else
{
for (int i = Temp.Length; i > 0; i--)
{
int Data = Convert.ToInt16(Temp[Temp.Length - i]);
Info += Base[Data - 48];
Info += Scale[i + 1];
}
}
#endregion
return Info;
}
#endregion

posted @ 2013-03-27 11:43  待到天亮了  阅读(271)  评论(0编辑  收藏  举报