我的转换函数:
function Tprintform.Currency(rmb:do
uble): string;
var s1,s2,s3,s4,dxs:string;
l,l1,l2,l3:integer;
begin
s1:='分角元拾佰仟万拾佰仟亿拾佰仟万拾佰仟万';
s2:='零壹贰叁肆伍陆柒捌玖';
l:=length(floattostr(rmb));
if copy(floattostr(rmb),l-2,1)='.' then
begin
dxs:=floattostr(abs(rmb));
end
else
begin
if copy(floattostr(rmb),l-1,1)='.' then
dxs:=floattostr(abs(rmb))+'0'
else
dxs:=floattostr(abs(rmb))+'.00'
end;
l1:=length(dxs);
dxs:=copy(dxs,1,l1-3)+copy(dxs,l1-1,2);
s3:='';
l2:=length(dxs);
l3:=0;
while l2>0do
begin
s3:=copy(s1,l3*2+1,2)+s3;
s3:=copy(s2,strtoint(copy(dxs,l2,1))*2+1,2)+s3;
l2:=l2-1;
l3:=l3+1;
end;
s4:='';
l2:=1;
while l2<length(s3)do
begin
if copy(s3,l2,2)='零' then
begin
if copy(s3,l2+2,2)='万' then
begin
if copy(s4,length(s4)-1,2)='零' then
s4:=copy(s4,1,length(s4)-2)+'万'
else
s4:=s4+'万';
end;
if copy(s3,l2+2,2)='元' then
begin
if copy(s4,length(s4)-1,2)='零' then
s4:=copy(s4,1,length(s4)-2)+'元'
else
s4:=s4+'元';
end;
if copy(s3,l2+2,2)='亿' then
begin
if copy(s4,length(s4)-1,2)='零' then
s4:=copy(s4,1,length(s4)-2)+'亿'
else
s4:=s4+'亿';
end;
if copy(s4,length(s4)-1,2)<>'零' then
s4:=s4+'零';
end
else
s4:=s4+copy(s3,l2,4);
l2:=l2+4;
end;
if copy(s4,length(s4)-3,4)='元零' then
begin
s4:=copy(s4,1,length(s4)-2)+'整';
end;
if copy(s4,length(s4)-3,4)='角零' then
begin
s4:=copy(s4,1,length(s4)-2)+'整';
end;
if copy(s4,length(s4)-1,2)='零' then
begin
s4:=copy(s4,1,length(s4)-2)+'元整';
end;
Currency:=s4;
end;