private static Dictionary<string, string> digits = null;
static General()
{
digits = new Dictionary<string, string>();
digits.Add(".","点");
digits.Add("0", "零");
digits.Add("1", "一");
digits.Add("2", "二");
digits.Add("3", "三");
digits.Add("4", "四");
digits.Add("5", "五");
digits.Add("6", "六");
digits.Add("7", "七");
digits.Add("8", "八");
digits.Add("9", "九");
}
public static string GetCnDigit(decimal decimals)
{
string str = null;
string strTemp1 = (long)decimals + "";
string strTemp2 = (decimals - (long)decimals) > 0 ? ((decimals - (long)decimals) + "") : "";
if (strTemp2.Length > 0) strTemp2 = strTemp2.Substring(1);
strTemp2 = strTemp2.TrimEnd('0');
do
{
string firstChar = strTemp1.Substring(0, 1);
if (firstChar != "0")
{
if (strTemp1.Length == 9) str += digits[firstChar] + "亿";
else if (strTemp1.Length == 8) str += digits[firstChar] + "千";
else if (strTemp1.Length == 7) str += digits[firstChar] + "百";
else if (strTemp1.Length == 6) str += digits[firstChar] + "十";
else if (strTemp1.Length == 5) str += digits[firstChar] + "万";
else if (strTemp1.Length == 4) str += digits[firstChar] + "千";
else if (strTemp1.Length == 3) str += digits[firstChar] + "百";
else if (strTemp1.Length == 2) str += digits[firstChar] + "十";
else if (strTemp1.Length == 1) str += digits[firstChar];
}
strTemp1 = strTemp1.Substring(1);
} while (strTemp1.Length > 0);
if (decimals < 1) str += "零";
foreach (char ch in strTemp2)
str += digits[ch + ""];
return str;
}