[记录]将小写金额转换为大写金额

void MainFormLoad(object sender, EventArgs e)
{
this.Text = GetToZHString(1234325.78f);
}
public static string GetToZHString(float value)
{
string str = "";
string[] s = { "", "", "", "", "", "", "", "", "", "", "亿", "", "", "" };
char[] c = { '', '', '', '', '', '', '', '', '', '' };
bool b = value < 0;
if (b)
{
value = 0 - value;str = "";
}
string temp = value.ToString("#0.00").Replace(".", string.Empty);

int count = temp.Length - 1;
for (int i = 0; i <= count; i++)
{
str += c[int.Parse(temp[i].ToString())] + s[count - i];
}
return str;
}

posted @ 2011-10-25 10:10  Crazy Coder  阅读(350)  评论(0编辑  收藏  举报