private string ChineseMoney(int num)
{
string retVal = string.Empty;
string money = num.ToString();
char[] chrM = money.ToCharArray();
string[] NumChineseCharacter = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
string[] NumCharacter = new string[] { "", "拾", "佰", "仟", "万" };
int x = 0;
for (int i = chrM.Length - 1; i >= 0; i--)
{
if (chrM[i] == '0' && string.IsNullOrEmpty(retVal) == false)
{
retVal = NumChineseCharacter[0] + retVal;
}
else if (chrM[i] != '0')
{
retVal = NumChineseCharacter[int.Parse(chrM[i].ToString())] + NumCharacter[x] + retVal;
}
x++;
}
retVal = retVal.Replace("零零零", "");
retVal = retVal.Replace("零零", "零");
if (string.IsNullOrEmpty(retVal) == true)
{
retVal = "零";
}
//else
//{
// retVal += "";
//}
if (retVal.Length > 3)
{
retVal = retVal.Replace("零", "");
}
return retVal;
}
{
string retVal = string.Empty;
string money = num.ToString();
char[] chrM = money.ToCharArray();
string[] NumChineseCharacter = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
string[] NumCharacter = new string[] { "", "拾", "佰", "仟", "万" };
int x = 0;
for (int i = chrM.Length - 1; i >= 0; i--)
{
if (chrM[i] == '0' && string.IsNullOrEmpty(retVal) == false)
{
retVal = NumChineseCharacter[0] + retVal;
}
else if (chrM[i] != '0')
{
retVal = NumChineseCharacter[int.Parse(chrM[i].ToString())] + NumCharacter[x] + retVal;
}
x++;
}
retVal = retVal.Replace("零零零", "");
retVal = retVal.Replace("零零", "零");
if (string.IsNullOrEmpty(retVal) == true)
{
retVal = "零";
}
//else
//{
// retVal += "";
//}
if (retVal.Length > 3)
{
retVal = retVal.Replace("零", "");
}
return retVal;
}