Show: Delphi C++
Display Preferences

System.SysUtils.TextToFloat

From XE2 API Documentation
Jump to: navigation, search

Delphi

function TextToFloat(Buffer: PWideChar; var Value; ValueType: TFloatValue): Boolean;
function TextToFloat(Buffer: PWideChar; var Value; ValueType: TFloatValue; const AFormatSettings: TFormatSettings): Boolean;
function TextToFloat(Buffer: PAnsiChar; var Value; ValueType: TFloatValue): Boolean;
function TextToFloat(Buffer: PAnsiChar; var Value; ValueType: TFloatValue; const AFormatSettings: TFormatSettings): Boolean;

C++

extern PACKAGE bool __fastcall TextToFloat(System::WideChar * Buffer, void *Value, TFloatValue ValueType)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

Description

Converts a null-terminated string to a floating-point value.

Use TextToFloat to convert a null-terminated string, Buffer, to a floating-point value. The string must consist of an optional sign (+ or -), a string of digits with an optional decimal point, and an optional mantissa. The mantissa consists of 'E' or 'e' followed by an optional sign (+ or -) and a whole number. Leading and trailing blanks are ignored.

The converted value is assigned to the Value parameter, which must be of type Extended or Currency, as indicated by the ValueType parameter.

TextToFloat returns True if the conversion is successful, or False if the Buffer does not contain a valid floating-point value.

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

Code Examples

Personal tools
Previous Versions
Translations