FastReport 金额转大写
来源:互联网 发布:澜本嫁衣 知乎 编辑:程序博客网 时间:2024/04/28 17:24
function atoc(a: string): string;
var
string1, string2, string3, string4, ch1, ch2, s, s1, rmb: string;
i, j, k, zero: Integer;
begin
string1 := '零壹贰叁肆伍陆柒捌玖';
string2 := '佰拾万仟佰拾亿仟佰拾万仟佰拾元角分';
s1 := '';
zero := 0;
rmb := '';
try
s := trim(str);
s := format('%.2f', [strtofloat(str)]);
s := Trim(FloatToStr(strtofloat(str) * 100)); // '将数字转成整型字符串
j := Length(s); // '字符串长度
string4 := copy(string2, Length(string2) - j * 2 + 1, j * 2); // '取出所需最大位数的表示
for i := 1 to j do
begin
string3 := copy(s, i, 1);
ch1 := copy(string1, (StrToInt(string3) + 1) * 2 - 1, 2);
ch2 := copy(string4, i * 2 - 1, 2);
if string3 <> '0' then
zero := 0
else
begin
zero := zero + 1;
if (j - i <> 14) and (j - i <> 10) and (j - i <> 6) and (j - i <> 2) or (zero > 3) and (j - i = 6) then
ch2 := '';
if (copy(s, i, 2) = '00') or (string3 = '0') and (j - i = 14) or (j - i = 10) or (j - i = 6) or (j - i = 2) or (j - i = 0) then
ch1 := '';
end;
rmb := rmb + ch1 + ch2;
if (j - i = 14) or (j - i = 10) or (j - i = 6) or (j - i = 2) then
if (copy(s, i, 1) = '0') and (copy(s, i + 1, 1) <> '0') then
rmb := rmb + '零';
end;
if string3 = '0' then
rmb := rmb + '整';
Result := rmb;
except
Result := '';
end;
end;
var
string1, string2, string3, string4, ch1, ch2, s, s1, rmb: string;
i, j, k, zero: Integer;
begin
string1 := '零壹贰叁肆伍陆柒捌玖';
string2 := '佰拾万仟佰拾亿仟佰拾万仟佰拾元角分';
s1 := '';
zero := 0;
rmb := '';
try
s := trim(str);
s := format('%.2f', [strtofloat(str)]);
s := Trim(FloatToStr(strtofloat(str) * 100)); // '将数字转成整型字符串
j := Length(s); // '字符串长度
string4 := copy(string2, Length(string2) - j * 2 + 1, j * 2); // '取出所需最大位数的表示
for i := 1 to j do
begin
string3 := copy(s, i, 1);
ch1 := copy(string1, (StrToInt(string3) + 1) * 2 - 1, 2);
ch2 := copy(string4, i * 2 - 1, 2);
if string3 <> '0' then
zero := 0
else
begin
zero := zero + 1;
if (j - i <> 14) and (j - i <> 10) and (j - i <> 6) and (j - i <> 2) or (zero > 3) and (j - i = 6) then
ch2 := '';
if (copy(s, i, 2) = '00') or (string3 = '0') and (j - i = 14) or (j - i = 10) or (j - i = 6) or (j - i = 2) or (j - i = 0) then
ch1 := '';
end;
rmb := rmb + ch1 + ch2;
if (j - i = 14) or (j - i = 10) or (j - i = 6) or (j - i = 2) then
if (copy(s, i, 1) = '0') and (copy(s, i + 1, 1) <> '0') then
rmb := rmb + '零';
end;
if string3 = '0' then
rmb := rmb + '整';
Result := rmb;
except
Result := '';
end;
end;
0 0
- FastReport 金额转大写
- 在fastreport中打印空白表格及小写金额转大写金额
- 小写金额转大写金额
- 小写转大写金额
- 转大写金额
- 金额小写转大写
- 金额小写转大写
- 小写转大写金额
- 小写转大写金额
- 金额小写转大写
- 金额小写转大写
- 小写转大写金额
- 金额小写转大写
- 金额小写转大写
- 金额转大写
- 金额转大写
- 金额转大写
- 数字金额转大写
- 万里长城第一里——实习之后台开发
- ZOJ 1806 (小数高精度)
- FTPUpload
- DDos1
- 金软PDF转换(x-PDFConper)
- FastReport 金额转大写
- [高斯消元] poj 1222 EXTENDED LIGHTS OUT
- 我要学习javascript
- 一种静态hash的实现
- DirectFB中的一些结构(Screen,Window, Layer, Surface)及其之间的关系
- SSH原理与运用(一):远程登录
- Linux中.o,.a,.o,.so文件的意义程实现
- 筛法素数
- eclipse 中 Path for project must have only one segment