Autor Beitrag
jamany
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 73



BeitragVerfasst: So 16.03.03 15:29 
Wo finde ich denn eine Funktion, die einen Zahlenbetrag in Worte umwandelt?
mars
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 238

Debian Woody, Win 2000, Win XP
D7 Ent, Kylix 3
BeitragVerfasst: So 16.03.03 15:34 
IntToStr() falls es ein Integer ist, sonst zB FloatToStr(). In der OH findest du auch weitere Konvertierungsfunktionen in Strings.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 16.03.03 15:51 
Ich glaube du willst aus 2 --> zwei machen oder täusche ich mich da?

Also eine offizielle Funktion gibt es dafür nicht, aber ich glaube so könnte man das lösen:

Du hast die Zahl 2541,25
und fängst mittels case an 2 --> zwei
dann ermittelst du den Abstand zum Komma 3 Zahlen dazwischen --> tausend
wieder case 5 --> fünf
wieder Abstand zum Komma 2 --> hundert
wenn Abstand zum Komma = 2 dann
case letzte Zahl vor dem Komma 1 --> ein
case vorletzte Zahl vor dem Komma 4 -->undvierzig
if , then ' Komma '
case nächste Zahl 2 --> zwei
case nächste zahl 5 --> fünf
ende wenn nächste Zahl > length

2541,25 --> zweitausendfünfhunderteinundvierzig Komma zweifünf

1. Das ist verdammt viel Arbeit
2. Das hier oben ist nur ein stilisierter Code
3. eigentlich musst du das ganze mit case vorher auf den Abstand zum Komma überprüfen und für jeden Fall neu schreiben, den 1,25 --> eins Komma zweifünf und 21,25 --> einundzwanzig Komma zweifünf außerdem 0,25 --> null Komma zweifünf und 100,25 --> einhundert Komma zweifünf.
4. Ich hoffe es war verständlich.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 16.03.03 17:03 
Schau doch mal in unsere FAQ: ...einen Betrag in Worten schreiben?

Gruß
Tino
jamany Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 73



BeitragVerfasst: So 16.03.03 17:22 
Titel: danke
ooops, habe ich dann wohl nicht in den FAQs gesehen...

trotzdem danke an derDoc für die Überlegung... War auch genauso gemeint...
jamany Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 73



BeitragVerfasst: So 16.03.03 17:40 
Titel: wie einbinden?
Das will irgendwie nicht klappen...

Ich brauche die Funktion in meiner Unit4 die zu Form4 gehört. Bei einem Klick auf einen Button, soll der Wert in Worte umgewandelt werden. Wie muss ich die Funktion einbinden?

Ich habe die Funktion in meine Unit4 gleich nach

ausblenden Quelltext
1:
2:
3:
implementation

{$R *.dfm}


eingebunden

In die procedure für den Button habe ich dann

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm4.Button2Click(Sender: TObject);

var betrag:string;
begin
betrag := BetragInWorten(123,45);
Label1.Caption:=betrag;
end;


Was mache ich falsch? Ich bekomme die Fehlermeldung
[Error] Unit4.pas: Undeclared identifier: 'BetragInWorten'
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 16.03.03 17:51 
Hast du es auch oben unter private eingebaut?

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 17.03.03 10:44 
derDoc hat folgendes geschrieben:
Hast du es auch oben unter private eingebaut?

Das ist nicht notwendig.

jamany hat folgendes geschrieben:
Was mache ich falsch?

Poste doch mal die ganze Unit (wenn diese nicht zu lang ist).

Gruß
Tino
Pyr0cracker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 164

Win XP, Ubuntu 8.04, openSUSE 11.0
Delphi 7 Personal
BeitragVerfasst: Mo 17.03.03 11:53 
guck mal in den easy delphi helper 2000, da stehts drinne.

gruß
jamany Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 73



BeitragVerfasst: Mo 17.03.03 12:23 
In private einbauen hat nichts gebracht.

Ich hatte dann die Funktion sowohl in der Hauptunit, als auch in meiner Unit4 eingebaut und dann ging's. Keine Ahnung warum.

Trotzdem danke an alle!
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Di 18.03.03 16:41 
Schreibe doch deinen Code mal hierher. Ich habe das mal getestet und bei mir klappt das einwandfrei.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.