function XxToDx(hjnum: real): string; stdcall;
var
Vstr, zzz, cc, cc1, Presult: string;
xxbb: array[1..12] of string;
uppna: array[0..9] of string;
iCount, iZero, vPoint, vdtlno: integer;
begin
//*设置大写中文数字和相应单位数组*//
xxbb[1] := '亿';
xxbb[2] := '仟';
xxbb[3] := '佰';
xxbb[4] := '拾';
xxbb[5] := '万';
xxbb[6] := '仟';
xxbb[7] := '佰';
xxbb[8] := '拾';
xxbb[9] := '元';
xxbb[10] := '.';
xxbb[11] := '角';
xxbb[12] := '分';
uppna[0] := '零';
uppna[1] := '壹';
uppna[2] := '贰';
uppna[3] := '叁';
uppna[4] := '肆';
uppna[5] := '伍';
uppna[6] := '陆';
uppna[7] := '柒';
uppna[8] := '捌';
uppna[9] := '玖';
Str(hjnum: 12: 2, Vstr);
cc := '';
cc1 := '';
zzz := '';
result := '';
presult := '';
iZero := 0;
vPoint := 0;
for iCount := 1 to 10 do
begin
cc := Vstr[iCount];
if cc <> ' ' then
begin
zzz := xxbb[iCount];
if cc = '0' then
begin
if iZero < 1 then //*对“零”进行判断*//
cc := '零'
else
cc := '';
if iCount = 5 then //*对万位“零”的处理*//
if copy(result, length(result) - 1, 2) = '零' then
result := copy(result, 1, length(result) - 2) + xxbb[iCount]
+ '零'
else
result := result + xxbb[iCount];
cc1 := cc;
zzz := '';
iZero := iZero + 1;
end
else
begin
if cc = '.' then
begin
cc := '';
if (cc1 = '') or (cc1 = '零') then
begin
Presult := copy(result, 1, Length(result) - 2);
result := Presult;
iZero := 15;
end;
if iZero >= 1 then
zzz := xxbb[9]
else
zzz := '';
vPoint := 1;
end
else
begin
iZero := 0;
cc := uppna[StrToInt(cc)];
end
end;
result := result + (cc + zzz)
end;
end;
if Vstr[11] = '0' then //*对小数点后两位进行处理*//
begin
if Vstr[12] <> '0' then
begin
cc := '零';
result := result + cc;
cc := uppna[StrToInt(Vstr[12])];
result := result + (uppna[0] + cc + xxbb[12]);
end
end
else
begin
if iZero = 15 then
begin
cc := '零';
result := result + cc;
end;
cc := uppna[StrToInt(Vstr[11])];
result := result + (cc + xxbb[11]);
if Vstr[12] <> '0' then
begin
cc := uppna[StrToInt(Vstr[12])];
result := result + (cc + xxbb[12]);
end;
end;
result := result + '整';
end;
============方法二==================
function TfrmDeposit.GetValueStr(Value: real): string;
var
nV,n1:integer;
s1:string;
begin
nV:=Round(Value*100);
if nV>=1000000 then
begin
s1:='?';
nV:=nV mod 1000000;
end;
if nV>=100000 then
begin
n1:=nV div 100000;
nV:=nV mod 100000;
s1:=s1+GetNumStr(n1)+'仟';
end;
if nV>=10000 then
begin
n1:=nV div 10000;
nV:=nV mod 10000;
s1:=s1+GetNumStr(n1)+'佰';
end
else if copy (s1,length(s1)-1,2) ='仟' then
s1:=s1+'零';
if nV>=1000 then
begin
n1:=nV div 1000;
nV:=nV mod 1000;
s1:=s1+GetNumStr(n1)+'拾';
end
else if (copy (s1,length(s1)-1,2) ='仟')
or (copy (s1,length(s1)-1,2) ='佰') then
s1:=s1+'零';
if nV>=100 then
begin
n1:=nV div 100;
nV:=nV mod 100;
s1:=s1+GetNumStr(n1)+'元';
end
else if (copy (s1,length(s1)-1,2) ='零') then
s1:=copy(s1,1,length(s1)-2)+'元'
else
s1:=s1+'元';
if nV=0 then
s1:=s1+'整'
else
begin
if nV>=10 then
begin
n1:=nV div 10;
nV:=nV mod 10;
s1:=s1+GetNumStr(n1)+'角';
end;
if nV>0 then
begin
if (copy (s1,length(s1)-1,2) <>'角') then
s1:=s1+'零';
s1:=s1+GetNumStr(nV)+'分';
end;
end;
result:=s1;
end;
function TfrmDeposit.GetNumStr(n: integer): string;
begin
case n of
0: result:='零';
1: result:='壹';
2: result:='贰';
3: result:='叁';
4: result:='肆';
5: result:='伍';
6: result:='陆';
7: result:='柒';
8: result:='捌';
9: result:='玖';
end;
end;