Autor Beitrag
Bernhard
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Fr 12.07.02 13:29 
Eine Rechnung liefert einen Zahlenwert mit Nachkommastellen.
Da muß ich doch für das Ergebnis einen Realwert nehmen?
Wenn ich dieses dann darstellen will muß es aber doch ein String sein?
Wie konvertiert man einen Realwert in einen String?
Oder wie kann man anders zu einer Lösung kommen?
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Fr 12.07.02 13:36 
Hallo,

eine Einfache möglichkeit bitet
ausblenden Quelltext
1:
function FloatToStr(Value: Extended): string;					

aus der Unit Sysutils. Wesentlich mehr einflusnehmen kannst du aber bei der Funktion
ausblenden Quelltext
1:
function Format(const Format: string; const Args: array of const): string;					

aus der selben unit. Über den Formatstring kannst du (neben einem beschreibenen Text) auch dinge wie die nachkommastellen festlegen oder das Ergebnis auch Hexadezimal ausgeben. Auch das umwandeln von mehreren Werten ist möglich.

Genaueres zu den Funktionen findest du wie üblich in der Online-Hilfe.

Gruß
Klabautermann
MaximusMR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Sa 13.07.02 13:07 
warum erklärt ihr das an ner Funktion. Naja ich bin 17 und arbeite noch nich so lang mit delphi. Aber hier auch mein Tipp

edit1.text:=flaottostr(REALVARIABLE);

so wird der wert dann im Edit1 Feld angezeigt
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Sa 13.07.02 17:45 
Und damit verwendes du eine der beiden Delphi Funktionen die ich ober vorgestellt habe?
Wo ist das Problem?

Gruß
Klabautermann
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Sa 13.07.02 17:55