Difference between revisions of "Str/de"
From Lazarus wiki
Jump to navigationJump to searchLine 16: | Line 16: | ||
begin | begin | ||
i := 123; | i := 123; | ||
− | Str(i, s); | + | Str(i, s); // ohne Formatierung |
WriteLn(s); | WriteLn(s); | ||
Str(i: 8, s); // String formatieren | Str(i: 8, s); // String formatieren | ||
Line 22: | Line 22: | ||
f := 123.456; | f := 123.456; | ||
− | Str(f, s); | + | Str(f, s); // ohne Formatierung |
WriteLn(s); | WriteLn(s); | ||
Str(f: 8: 4, s); // String formatieren | Str(f: 8: 4, s); // String formatieren | ||
+ | WriteLn(s); | ||
+ | Str(f: 8, s); // String als komplettes formatieren | ||
WriteLn(s); | WriteLn(s); | ||
end. | end. |
Revision as of 18:27, 22 April 2018
│
Deutsch (de) │
English (en) │
русский (ru) │
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.
Hinweis: Bei Float-Typen muss beachtet werden, das immer ein Punkt als Dezimaltrenner ausgegeben wird, egal wie die Ländereinstellungen des OS eingestellt sind.
Beispiel
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:
- Val - String in numerischen Wert konvertieren.
Autor: Mathias