In the financial software, there is always a capital amount representation, the following is a simple lowercase amount converted to uppercase function, the idea is simple (you can say rotten, incredibly using the position to convert), but it can be almost unlimited conversion, as long as you can read out and write in:
function Tform1.smalltobig (small:real): string;
var smallmonth,bigmonth:string;
WEI1,QIANWEI1:STRING[2];
Wei,qianwei,dianweizhi,qian:integer;
Begin
{-------Modify the parameter to make the value exact-------}
{The number of digits after the decimal point, or you can change the value if needed}
Qianwei:=-2; {Convert to Currency form, add a few more zeros after the decimal point.}
Smallmonth:=formatfloat (0.00,small);
{---------------------------------}
Dianweizhi: =pos (., smallmonth); {Position of decimal point}
{Loop every bit of the lowercase currency, from the right position to the left of the small letter}
For Qian:=length (smallmonth) Downto 1 Do
Begin
{If you don't read the decimal point, continue}
If Qian<>dianweizhi Then
Begin
{Convert number at position to uppercase}
Case Strtoint (copy (smallmonth,qian,1)) of
1:wei1:= one; 2:wei1:=;
3:wei1:= three; 4:wei1:= establishments;
5:wei1:= Wu; 6:wei1:= land;
7:wei1:= Qi; 8:wei1:= BA;
9:wei1:= Nine; 0:wei1:= 0;
End
{Judging the capitalization position, you can continue to increase to the maximum value of real type, but who has so much money}
Case Qianwei of
-3:qianwei1:=;
-2:qianwei1:= points;
-1:qianwei1:= angle;
0:qianwei1:= Yuan;
1:qianwei1:= pick up;
2:qianwei1:= Bai;
3:qianwei1:= thousand;
4:qianwei1:= million;
5:qianwei1:= pick up;
6:qianwei1:= Bai;
7:qianwei1:= thousand;
8:qianwei1:= billion;
9:qianwei1:= 10;
10:qianwei1:= Bai;
11:qianwei1:= thousand;
End
Inc (Qianwei);
Bigmonth: =wei1+qianwei1+bigmonth; {Combined into uppercase amounts}
End
End
Smalltobig:=bigmonth;
End
The program calls the following "Edit1.text:=smalltobig (1234567890.1234);" He automatically defaults to two digits after the decimal point.