2019独角兽企业重金招聘Python工程师标准>>>
//金额转化为大写
function Changdx2(mmje: Double): String;
const s1: String = '零壹贰叁肆伍陆柒捌玖';s2: String = '分角元拾佰仟万拾佰仟亿拾佰仟万';function StrTran(const S, S1, S2: String): String;beginResult := StringReplace(S, S1, S2, [rfReplaceAll]);end;var s, dx: String;i, Len: Integer;
begin
if mmje < 0 thenbegin dx :&#61; &#39;负&#39;;mmje :&#61; -mmje;end;s :&#61; Format(&#39;%.0f&#39;, [mmje*100]);Len :&#61; Length(s);for i :&#61; 1 to Len dodx :&#61; dx &#43; Copy(s1, (Ord(s[i]) - Ord(&#39;0&#39;))*2 &#43; 1, 2) &#43; Copy(s2, (Len - i)*2 &#43; 1, 2);dx :&#61; StrTran(StrTran(StrTran(StrTran(StrTran(dx, &#39;零仟&#39;, &#39;零&#39;), &#39;零佰&#39;, &#39;零&#39;), &#39;零拾&#39;, &#39;零&#39;), &#39;零角&#39;, &#39;零&#39;), &#39;零分&#39;, &#39;整&#39;);dx :&#61; StrTran(StrTran(StrTran(StrTran(StrTran(dx, &#39;零零&#39;, &#39;零&#39;), &#39;零零&#39;, &#39;零&#39;), &#39;零亿&#39;, &#39;亿&#39;), &#39;零万&#39;, &#39;万&#39;), &#39;零元&#39;, &#39;元&#39;);if dx &#61; &#39;整&#39; then Result :&#61; &#39;零元整&#39;else Result :&#61; StrTran(StrTran(dx, &#39;亿万&#39;, &#39;亿零&#39;), &#39;零整&#39;, &#39;整&#39;);
end;