From Clomosy Docs

Revision as of 14:03, 8 October 2024 by ClomosyManager (talk | contribs)

The StrToFloat function converts a number string, FloatString such as '123,456' into an Extended floating point number. It supports integer, floating point, and scientific (exponent) formats.

Example
TRObject Syntax

 var
   stringValue : string;
   floatValue  : float;
 
 {
   // Set up the source string containing a number representation
   stringValue = '123,456';
   // Convert it to a floating point number
   floatValue  = StrToFloat(stringValue);
   // And display the value
   ShowMessage(stringValue+' = '+FloatToStr(floatValue));
 }

Base Syntax

 var
   stringValue : string;
   floatValue  : float;
 
 begin
 
   // Set up the source string containing a number representation
   stringValue := '123,456';
 
   // Convert it to a floating point number
   floatValue  := StrToFloat(stringValue);
 
   // And display the value
   ShowMessage(stringValue+' = '+FloatToStr(floatValue));
 
 end;

Output:

See Also