|
/// <summary>
/// 将数字转换为汉字大写表示
/// </summary>
/// <param name="dec">欲转换的decimal</param>
/// <returns>汉字大写字符串</returns>
public static string Convert(decimal dec)
{
string s = dec.ToString("#L#E#D#C#K#E#D#C#J#E#D#C#I#E#D#C#H#E#D#C#G#E#D#C#F#E#D#C#.0B0A");
string d = Regex.Replace(
s,
@"((?<=-|^)[^1-9]*)|((?'z'0)[0A-E]*((?=[1-9])|(?'-z'(?=[F-L\.]|$))))|((?'b'[F-L])(?'z'0)[0A-L]*((?=[1-9])|(?'-z'(?=[\.]|$))))", "${b}${z}"
);
string c = Regex.Replace(
d, ".",
delegate(Match m)
{
return "负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万亿兆京垓秭穣"[m.Value[0] - '-'].ToString();
}
);
return c;
}
|
|