Home > Back-end >  How can you keep two decimal places
How can you keep two decimal places

Time:10-11

Label1. Caption:=CurrTostr (strTocurr (Label2. Caption)/strTocurr (Label3. Caption));

CodePudding user response:

Label1. Caption:=Format (' % 0.2 f, [strTocurr (Label2. Caption)/strTocurr (Label3. Caption)]);

CodePudding user response:

The Format to Format:

The Format (' this is % n ', [4552.2176]).
Returns this is 4552.22

You can use:
 
Label1. Caption:=Format (' % n '[strTocurr (Label2. Caption)/strTocurr (Label3. Caption)]);

CodePudding user response:

1, the display can also be used:
FormatFloat can also
Such as: FormatFloat (' 0.00 ', 123.456);
The output of 123.45

2, if in order to save values, can use a Round or Trunc (* 100)/100, such as:
A double v=Round (floatValue * 100)/100;
  • Related