From Clomosy Docs

No edit summary
No edit summary
Line 6: Line 6:


<b>Example</b><br>
<b>Example</b><br>
<b>TRObject Syntax</b><br>
 
<pre>
<pre>
  var
  var
Line 20: Line 20:
   ShowMessage(stringValue+' = '+FloatToStr(floatValue));
   ShowMessage(stringValue+' = '+FloatToStr(floatValue));
  }
  }
</pre>
<b>Base Syntax</b><br>
<pre>
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;
</pre>
</pre>



Revision as of 12:56, 13 November 2024

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

 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));
 }

Output:

See Also