![]() |
StrToReal <--- gibt es so etwas
Hallo!
Noch spät am Abend eine kurze Frage: Ich hab hier einen Wert in einem Edit und daraus muss ich einen Real-Wert machen um später damit zu rechnen. Wie kann ich diesen Wert umrechnen (also von String nach Real)? Danke im Vorraus! MfG Florian :hi: |
Re: StrToReal <--- gibt es so etwas
Ja. StrToFloat ;-)
...:cat:... |
Re: StrToReal <--- gibt es so etwas
Delphi-Quellcode:
[edit]
function StrToFloat(const S: string): Extended;
function StrToFloatDef(const S: string; const Default: Extended): Extended; overload; och menno :( |
Re: StrToReal <--- gibt es so etwas
gibt es:
SysUtils.StrToFloat(const S : String) : Extended; Ansonsten, wenn Du es etwas sicherer machen willst:
Delphi-Quellcode:
Edit: Wenn man schonmal glänzen will... :lol:
function StrToFloatF(Zahl_Als_Text:String):Double;
var TmpStr : String; i :integer; Positiv : Boolean; begin Positiv := TRUE; TmpStr := ''; for i:= 1 to length(Zahl_Als_Text) do begin if Zahl_Als_Text[i] in ['0'..'9',','] then TmpStr := TmpStr+Zahl_Als_Text[i]; if Zahl_Als_Text[i] = '-' then Positiv := FALSE; end; if Positiv then Result := StrToFloat(TmpStr) else Result := StrToFloat(TmpStr)*-1; end; |
Re: StrToReal <--- gibt es so etwas
DANKE!!! :)
MfG Florian :dp: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:24 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