Solved

Converting a real number to string

Posted on 2000-04-10
2
134 Views
Last Modified: 2010-04-04
How do you convert a real number to string type??
0
Comment
Question by:Dushi
2 Comments
 
LVL 15

Accepted Solution

by:
simonet earned 50 total points
ID: 2702479
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
 

Expert Comment

by:scirocco1
ID: 2703498
You can use:
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision,
  Digits: Integer): string;

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now