Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function StrToFloat(const S: string): Extended; overload;
function StrToFloat(const S: string; const FormatSettings: TFormatSettings): Extended; overload;
Returns a floating point value from a string
S must consist of an optional sign (+ or -), a string of digits with an optional decimal point (which must match the current DecimalSeparator valuue), 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 second form of StrToFloat, refers to localization information contained in the FormatSettings parameter.
var ex: extended;
ex := StrToFloat('3,141,592.6535');
//ex == 3141592.6535
ex := StrToFloat('1.05E+2');
//ex == 105
ex := StrToFloat('$FF'); //trying to convert a hex number
// Exception : EConvertError
|
TFormatSettings,
FloatToStrF,
FormatFloat,
FloatToStr,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|