From Clomosy Docs

No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
function FloatToStr(Value Extended):string;
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function FloatToStr(Value: Extended):string;
</div>
 
The FloatToStr function converts a floating point number Value into a displayable string. The value is displayed to 15 digits of precision. The Value type may be any of the floating point types.<br>
The FloatToStr function converts a floating point number Value into a displayable string. The value is displayed to 15 digits of precision. The Value type may be any of the floating point types.<br>


'''Example:'''<br>
<b>Example</b><br>
:'''Base Syntax'''
  var
    LongNumberValue, ShortNumberValue : float;
 
  begin
    LongNumberValue := 1234567890.123456789;
    ShortNumberValue := 123.12;
 
    ShowMessage('LongNumberValue = '+'''FloatToStr'''(LongNumberValue));
    ShowMessage('ShortNumberValue = '+'''FloatToStr'''(ShortNumberValue));
  end;


:'''TRObject Syntax'''
<pre>
  var
var
    LongNumberValue, ShortNumberValue : float;
  LongNumberValue, ShortNumberValue : float;
 
  {
{
    LongNumberValue = 1234567890.123456789;
  LongNumberValue = 1234567890.123456789;
    ShortNumberValue = 123.12;
  ShortNumberValue = 123.12;
 
    ShowMessage('LongNumberValue = '+'''FloatToStr'''(LongNumberValue));
  ShowMessage('LongNumberValue = '+FloatToStr(LongNumberValue));
    ShowMessage('ShortNumberValue = '+'''FloatToStr'''(ShortNumberValue));
  ShowMessage('ShortNumberValue = '+FloatToStr(ShortNumberValue));
  }
}


</pre>


'''Output:'''<br>
<b>Output:</b><br>
<div class="alert alert-success" role="alert" data-bs-theme="light">
LongNumberValue = 1234567890,123456789<br>
ShortNumberValue = 123,12
</div>


LongNumberValue = 1234567890,123456789
<h2> See Also </h2>
ShortNumberValue = 123,12
* [[System_Library#Type_Conversion_Functions | Type Conversion Functions]]
{{#seo:|title=FloatToStr Using in Clomosy - Clomosy Docs}}
{{#seo:|description=Use FloatToStr in Clomosy to convert a floating-point number to a string with up to 15 digits of precision for accurate display.}}

Latest revision as of 14:09, 24 December 2024

The FloatToStr function converts a floating point number Value into a displayable string. The value is displayed to 15 digits of precision. The Value type may be any of the floating point types.

Example

 var
   LongNumberValue, ShortNumberValue : float;
 
 {
   LongNumberValue = 1234567890.123456789;
   ShortNumberValue = 123.12;
 
   ShowMessage('LongNumberValue = '+FloatToStr(LongNumberValue));
   ShowMessage('ShortNumberValue = '+FloatToStr(ShortNumberValue));
 }

Output:

See Also