public static string ToChineseStr(string str)
{
string result = string.Empty;
try
{
if (!Convert.IsDecimal(str)) // 判断是否为正整数
return result;
if (Double.Parse(str) > double.MaxValue) // 判断数值是否太大
return result;
char sign = '.'; //小数点
string[] splitstr = str.Split(sign); //按小数点分割字符串
if (splitstr.Length == 1) //只有整数部分
{
result = Convert.ToData(str) + "圆整";
}
else //有小数部分
{
result = Convert.ToData(splitstr[0]) + "圆";//转换整数部分
result += Convert.ToDecimalStr(splitstr[1]);//转换小数部分
}
}
catch (Exception ex)
{
Debug.WriteLine("Convert.ToChineseStr(string) :: " + ex.Message);
throw ex;
}
return result;
}