wiki.php 用Markdown写wiki是一种什么样的体验?

人民币金额大写转换.md

最后更新于 2019-10-06 15:00:18

https://www.zhihu.com/question/37926400/answer/74142424

public static String ConvertToChinese(Decimal number)
{
    var s = number.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");
    var 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}");
    var r = Regex.Replace(d, ".", m => "负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万亿兆京垓秭穰"[m.Value[0] - '-'].ToString());
    if (r.EndsWith("元"))//这两行是我加的
        r += "整";//感觉我拉低了前边代码的逼格……很惭愧
    return r;
}