"For developers", "Server scripts", "Functions description", "Converting types", "StrToFloat".
Converting a string to a floating-point number.
function StrToFloat(sValue: string): extended;
Parameter |
Type |
Value |
---|---|---|
sValue |
string |
string that you need to convert to a real number. |
Floating-point number that corresponds to the transmitted text string. If the string contains wrong data (for example, "Hello!"), the function returns 0. The decimal separator is the ".".
var
sValue: string;
x: extended;
begin
sValue := '123.456E+002';
x := strtofloat(sValue);
mLogScript('StrToFloat = ' + inttostr(trunc(x)), '');
end.
[08:47:14] (Log "StrToFloat"): StrToFloat = 12345