RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.FloatToText Function

Converts a floating-point value to an unterminated character string, using a specified Format, Precision and Digits.

Pascal
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision: Integer; Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision: Integer; Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision: Integer; Digits: Integer; const FormatSettings: TFormatSettings): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision: Integer; Digits: Integer; const FormatSettings: TFormatSettings): Integer; overload;
C++
int FloatToText(PAnsiChar BufferArg, const  Value, TFloatValue ValueType, TFloatFormat Format, int Precision, int Digits);
int FloatToText(PWideChar BufferArg, const  Value, TFloatValue ValueType, TFloatFormat Format, int Precision, int Digits);
int FloatToText(PAnsiChar BufferArg, const  Value, TFloatValue ValueType, TFloatFormat Format, int Precision, int Digits, const TFormatSettings FormatSettings);
int FloatToText(PWideChar BufferArg, const  Value, TFloatValue ValueType, TFloatFormat Format, int Precision, int Digits, const TFormatSettings FormatSettings);

FloatToText converts the given floating-point value to its decimal representation using the specified format, precision, and digits. The Value parameter must be a variable of type Extended or System::Currency, as indicated by the ValueType parameter. The resulting string of characters is stored in the given buffer, and the returned value is the number of characters stored. The resulting string is not null-terminated. 

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

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!