Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

Converting a real number to string

How do you convert a real number to string type??
0
Dushi
Asked:
Dushi
1 Solution
 
simonetCommented:
There are many ways to do it:

1) By using FloatToStr
   The string representaion keeps the same number of decimal place as the original number

Ex.:   Str := FloatToStr(MyRealNumber);

2) By using Format
   You can specify how the final string will look like

Ex.: Str := Format('%.4f', [PI]);

{ Str evaluates to '3.1428' }

Yours,

Alex
0
 
scirocco1Commented:
You can use:
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision,
  Digits: Integer): string;

Ex:
DesireString := FloatToStrF(YourValue,ffFixed,7,4);
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now