Autor Beitrag
delphinia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

XP Pro Sp2
Delphi 5 Standard
BeitragVerfasst: Mi 13.12.06 11:03 
In ein editfeld wir ein Betrag eingegeben!

Nun möchte ich gerne prüfen ob der betrag inkl Komma angegeben wurde und wenn nicht ,00 anhängen!
Wie realisiere ich das?

_________________
Gruss Doreen
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Mi 13.12.06 11:06 
schau dir mal die funktion format() an!

_________________
Anonymes Eckenkind
delphinia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

XP Pro Sp2
Delphi 5 Standard
BeitragVerfasst: Mi 13.12.06 11:19 
so?!
ausblenden Delphi-Quelltext
1:
ShowMEssage(format('%3d.00', [StrToInt(preis_new_text.text)]));					



Allerdings erhalte ich ne fehlermeldung wnen nen Komma im Preis_new_text steht!
Aber Beträge schreibt man nu mal mit Komma!?! :gruebel:

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt

_________________
Gruss Doreen
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Mi 13.12.06 11:30 
user profile icondelphinia hat folgendes geschrieben:
Aber Beträge schreibt man nu mal mit Komma!?! :gruebel:

nicht unbedingt... es gilt die Einstellung von Windows. Diese ist in der globalen Variable DecimalSeparator gespeichert.
Du kannst entweder diese Variable ändern, oder vor der format()-Funktion noch ein StrReplace() machen (also "," mit "." ersetzen)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 13.12.06 11:31 
user profile icondelphinia hat folgendes geschrieben:
Aber Beträge schreibt man nu mal mit Komma!?! :gruebel:
Aber nicht die, die man in StrToInt packt ;-) StrToFloat passt da wohl eher :-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
delphinia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

XP Pro Sp2
Delphi 5 Standard
BeitragVerfasst: Mi 13.12.06 11:40 
super - danke - das wars! Nun alles bestens ;-)

_________________
Gruss Doreen