RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.FloatToStrF Function

Converts a floating point value to a string, using a specified Format, Precision, and Digits.

Pascal
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision: Integer; Digits: Integer): string; overload;
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision: Integer; Digits: Integer; const FormatSettings: TFormatSettings): string; overload;
C++
AnsiString FloatToStrF(Extended Value, TFloatFormat Format, int Precision, int Digits);
AnsiString FloatToStrF(Extended Value, TFloatFormat Format, int Precision, int Digits, const TFormatSettings FormatSettings);

SysUtils

FloatToStrF converts the floating-point value given by Value to its string representation.  

The Value parameter is the value to convert.  

The Precision parameter specifies the precision of the given value. It should be 7 or less for values of type Single, 15 or less for values of type Double, and 18 or less for values of type Extended.  

The Digits and Format parameters together control how the value is formatted into a string. For details, see the description of TFloatFormat

If the given value is a NAN (not-a-number), the resulting string is 'NAN'. If the given value is positive infinity, the resulting string is 'INF'. If the given value is negative infinity, the resulting string is '-INF'. 

The first form of FloatToStrF is not thread-safe, because it uses localization information contained in global variables. The second form of FloatToStrF, which is thread-safe, refers to localization information contained in the FormatSettings parameter. Before calling the thread-safe form of FloatToStrF, you must populate FormatSettings with localization information. To populate FormatSettings with a set of default locale values, call GetLocaleFormatSettings

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!