[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

Str

Convert a numerical value to a string.

Declaration

Source position: system.fpd line 47

procedure Str(

  var X: TNumericType;

  var S: String

);

Description

Str returns a string which represents the value of X. X can be any numerical type. The actual declaration of Str is not according to pascal syntax, and should be

procedure Str(var X: TNumericType[:NumPlaces[:Decimals]];var S: String)

Where the optional NumPlaces and Decimals specifiers control the formatting of the string: NumPlaces gives the total width of the string, and Decimals the number of decimals after the decimal separator char.

Errors

None.

See also

Val

  

Calculate numerical/enumerated value of a string.

Example

Program Example68;

{ Program to demonstrate the Str function. }
Var S : String;

Function IntToStr (I : Longint) : String;

Var S : String;

begin
 Str (I,S);
 IntToStr:=S;
end;

begin
  S:='*'+IntToStr(-233)+'*';
  Writeln (S);
end.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.