Solved

Converting a real number to string

Posted on 2000-04-10
2
133 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

8 Experts available now in Live!

Get 1:1 Help Now