Formats a string and returns it to a variable.
procedure Str(X: Width; var S); overload; procedure Str(X: Decimals; var S); overload;
Str(Width X, S); Str(Decimals X, S);
In Delphi code, Str converts X to a string representation according to the Width and Decimals formatting parameters. The effect is like a call to Write except the resulting string is stored in S instead of being written to a text file.
X is an integer-type or real-type expression. Width and Decimals are integer-type expressions. S is a string-type variable or a zero-based character array variable if extended syntax is enabled.
Delphi Examples:
{ This example makes a simple string conversion routine and then prints an integer to the screen. } function MakeItAString(I: Longint): string; { Convert any integer type to a string } var S: string[11]; begin Str(I, S); Result:= S; end; procedure TForm1.Button1Click(Sender: TObject); begin Canvas.TextOut(10, 10, MakeItAString(-5322)); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|