用这个吧我也是看别人,再自己改的
unit SmallToBig;
interface
uses
Windows, Messages, SysUtils, Classes, Controls,
StdCtrls;
function SmallToBig01(Smallouble):string;
function SmallToBig02(Smallouble):string;
implementation
function SmallToBig01(Smallouble):string;
Var
Str:String;
do
tPos:Integer;
i:Integer;
bStart:Boolean;
sResult:WideString;
SmallDitouble;
begin
Result:='零圆整';
SmallDit:=Round((Small-INT(Small))*100)/100;
Small:=INT(Small)+SmallDit;
if Small<0.01 then
Exit;
Str:=FormatFloat('#.##',Small);
do
tPos:=Pos('.',Str);
ifdo
tPos=0 then
do
tPos:=length(Str)+1;
bStart:=False;
For i:=DotPos-1do
wnto 1do
begin
if (Str<>'0') and (not bStart) then
bStart:=True;
if ABS(i-DotPos) MOD 4=1 then
begin
if (Str='0') and (DotPos-i<>1) then
sResult:='零'+sResult;
Casedo
tPos-i of
1:sResult:='圆'+sResult;
5:sResult:='万'+sResult;
9:sResult:='亿'+sResult;
13:sResult:='兆'+sResult;
end;
bStart:=False;
end;
if (Str<>'0') then
begin
Case ABS(i-DotPos) MOD 4 of
0:sResult:='仟'+sResult;
2:sResult:='拾'+sResult;
3:sResult:='佰'+sResult;
end;
end;
Case Str of
'0':if bStart and (sResult[1]<>'零') then
begin
sResult:='零'+sResult;
bStart:=False;
end;
'1':sResult:='壹'+sResult;
'2':sResult:='贰'+sResult;
'3':sResult:='叁'+sResult;
'4':sResult:='肆'+sResult;
'5':sResult:='伍'+sResult;
'6':sResult:='陆'+sResult;
'7':sResult:='柒'+sResult;
'8':sResult:='捌'+sResult;
'9':sResult:='玖'+sResult;
end;
if Str<>'0' then
bStart:=True;
end;
Delete(Str,1,DotPos);
if Length(Str)>0 then
begin
Case Str[1] of
'0':if sResult<>'' then
sResult:=sResult+'零';
'1':sResult:=sResult+'壹';
'2':sResult:=sResult+'贰';
'3':sResult:=sResult+'叁';
'4':sResult:=sResult+'肆';
'5':sResult:=sResult+'伍';
'6':sResult:=sResult+'陆';
'7':sResult:=sResult+'柒';
'8':sResult:=sResult+'捌';
'9':sResult:=sResult+'玖';
end;
if Str[1]<>'0' then
sResult:=sResult+'角';
if Length(Str)>1 then
begin
Case Str[2] of
'1':sResult:=sResult+'壹';
'2':sResult:=sResult+'贰';
'3':sResult:=sResult+'叁';
'4':sResult:=sResult+'肆';
'5':sResult:=sResult+'伍';
'6':sResult:=sResult+'陆';
'7':sResult:=sResult+'柒';
'8':sResult:=sResult+'捌';
'9':sResult:=sResult+'玖';
end;
if Str[2]<>'0' then
sResult:=sResult+'分';
end else
sResult:=sResult+'整';
end else
sResult:=sResult+'整';
Result:=sResult;
end;
function SmallToBig02(Smallouble):string;
var
Temp_Str,sResult1,sResult2:string;
Small_length,i:integer;
Temp_Str1,Temp_Str2:string;
Temp_length,ll:integer;
Temp_je,ss:string;
begin
if Small=0 then
begin
Result:='零元整';
exit;
end;
Temp_Str:=formatfloat('0.0000',Small);
Temp_str1:=copy(Temp_str,1,pos('.',Temp_str)-1);
Temp_str2:=copy(Temp_Str,pos('.',Temp_str)+1,length(Temp_str)-pos('.',Temp_str));
Small_length:=length(Temp_str1);
Temp_je:=Temp_str1;
sResult1:='';
for i:=1 to Small_lengthdo
begin
Temp_length:=length(Temp_je);
ss:=copy(Temp_je,1,1);
Case strtoint(ss) of
1:sResult1:=sResult1+'壹';
2:sResult1:=sResult1+'贰';
3:sResult1:=sResult1+'叁';
4:sResult1:=sResult1+'肆';
5:sResult1:=sResult1+'伍';
6:sResult1:=sResult1+'陆';
7:sResult1:=sResult1+'柒';
8:sResult1:=sResult1+'捌';
9:sResult1:=sResult1+'玖';
0:sResult1:=sResult1+'零';
end;
ll:=Temp_length mod 4;
case ll of
2: sResult1:=sResult1+'拾';
3: sResult1:=sResult1+'佰';
0: sResult1:=sResult1+'仟';
end;
ll:=Temp_length div 4;
case ll of
1: if (Temp_length mod 5)=0 then
sResult1:=sResult1+'万';
2: if (Temp_length mod 5)=0 then
sResult1:=sResult1+'亿';
3: if (Temp_length mod 5)=0 then
sResult1:=sResult1+'兆';
end;
Temp_je:=copy(Temp_str1,i+1,Small_length-i);
end;
sResult1:=sResult1+'元';
Temp_je:=Temp_str2;
sResult2:='';
for i:=1 to 4do
begin
ss:=copy(Temp_je,i,1);
Case strtoint(ss) of
1:sResult2:=sResult2+'壹';
2:sResult2:=sResult2+'贰';
3:sResult2:=sResult2+'叁';
4:sResult2:=sResult2+'肆';
5:sResult2:=sResult2+'伍';
6:sResult2:=sResult2+'陆';
7:sResult2:=sResult2+'柒';
8:sResult2:=sResult2+'捌';
9:sResult2:=sResult2+'玖';
0:sResult2:=sResult2+'零';
end;
case i of
1:sResult2:=sResult2+'角';
2:sResult2:=sResult2+'分';
3:sResult2:=sResult2+'厘';
4:sResult2:=sResult2+'毫';
end;
end;
Result:=sResult1+sResult2;
end;