![]() |
FloatToStr in nonVCL?
hey,
ich komme hier einfach nicht weiter, wie ich eine fließkommer zahl in einen string umwandle, mit Str() bekomm ich nur einen blödsinn heraus, und mit wvsprintf() finde ich auch keinen weg .. |
Re: FloatToStr in nonVCL?
ich glaub ich habs, auf 2 stellen gerundet ..
Delphi-Quellcode:
function FloatToStr(E: Extended): String;
var S: String; begin Str(E:2:2, S); FloatToStr := S; end; |
Re: FloatToStr in nonVCL?
Ich habe jetzt nicht delphi hier aber mit str muss es gehen, einfach man OH nachschlagen.
EDIT:
Delphi-Quellcode:
function FloatToStr(E: Extended): String;
begin Str(E:2:2, Result); end; |
Re: FloatToStr in nonVCL?
Delphi-Quellcode:
Grüße vom marabu
function FloatToStr(e: Extended; width, decimals: Byte): String;
var i: integer; begin Str(e:width:decimals, Result); if DecimalSeparator = ',' then repeat i := Pos('.', Result); if i > 0 then Result[i] := DecimalSeparator; until i = 0; end; |
Re: FloatToStr in nonVCL?
danke sniper_w und marabu
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:35 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz