Anyone know how to convert real e.g. 105.6 to string e.g. 105.6?

In Delphi, I like the FormatFloat function. If you look at the docs for it, you can also check out the "See Also" stuff.

I have try the FormatFloat function but I keep a error message:
'no overloaded version of 'FormatFloat' that can be called with these arguments '.
I don't know how to fix it please can you give me some example or tell me how it work.

Place your cursor on the name "FormatFloat" and press F1. You'll get a help page telling you everything you need to know about the function. Mine says:

Formats a floating point value

Unit
SysUtils

Category
floating point conversion routines [B]function[/B] FormatFloat([B]const[/B] Format: [B]string[/B]; Value: Extended): [B]string[/B]; Description
...

So you'll want to make sure the first argument is a string and the second argument is a floating point type (single, double, extended, real, or real48).

Good luck.

Hi afro007.,

Duoas is right about using the FloatFormat, but here is an example:

Var TempSum : Real;

TempSum:=105.6;
Label1.Caption:=FormatFloat('###,###.##', TempSum);

however there are other ways to convert Real to String : FloatToStr.
Label1.Caption:=FloatToStr(TempSum);
(which can show you 105.6343254)
and FloatToStrF, and FloatToText.

sorry for my english, i hope i helped.

This article has been dead for over six months. Start a new discussion instead.