任何数字转换为中文货币类型(6)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-06 18:18 点击:次
rstring = rstring.Replace("零零", "零");
rstring = rstring.Replace("零零", "零");
return rstring;
}
/// <summary>
/// 转换二位数字
/// </summary>
public string Convert2Digit(string str)
{
string str1 = str.Substring(0, 1);
string str2 = str.Substring(1, 1);
string rstring = "";
rstring += ConvertChinese(str1) + "拾";
rstring += ConvertChinese(str2);
rstring = rstring.Replace("零拾", "零");
rstring = rstring.Replace("零零", "零");
return rstring;
}
/// <summary>
/// 将一位数字转换成中文大写数字
/// </summary>
public string ConvertChinese(string str)
{
//"零壹贰叁肆伍陆柒捌玖拾佰仟萬億圆整角分"
string cstr = "";
switch (str)
{
case "0": cstr = "零"; break;
case "1": cstr = "壹"; break;
case "2": cstr = "贰"; break;
case "3": cstr = "叁"; break;
case "4": cstr = "肆"; break;
case "5": cstr = "伍"; break;
case "6": cstr = "陆"; break;
case "7": cstr = "柒"; break;
case "8": cstr = "捌"; break;
case "9": cstr = "玖"; break;
}
return (cstr);
}
摘自 caoruyi15的专栏
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>