Sign in Join
Wiki copytemporary

Revision 1 of 1, by Trev on 2-28-2020. The page as it is now.

Str/de

Str

Beschreibung

Mit Str, kann man einen numerischen Wert in einen String konvertieren. Es ist sogar mittels : Breite: Dezimal eine Formatierung des Stringes möglich, siehe Beispiel.

Note: Bei Float-Typen muss beachtet werden, das immer ein Punkt als Dezimaltrenner ausgegeben wird, egal wie die Ländereinstellungen des OS eingestellt sind.

Beispiel

pascal
var
  s: string;
  i: integer;
  f: single;

begin
  i := 123;
  Str(i, s);         // ohne Formatierung
  WriteLn(s);
  Str(i: 8, s);      // String formatieren
  WriteLn(s);

  f := 123.456;
  Str(f, s);         // ohne Formatierung
  WriteLn(s);
  Str(f: 8: 4, s);   // String formatieren
  WriteLn(s);
  Str(f: 8, s);      // String als komplettes formatieren
  WriteLn(s);
end.

Siehe auch:


From the Free Pascal wiki, page "Str/de", as it stood on 2020-02-28 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.