Autor Beitrag
WEBSTER
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mi 27.04.05 11:41 
Salute,

ich möchte den ersten Wert eines zweidimensionalen Arrays ermitten, aber wie ?

Mein Array lautet:

array_firmen[Int_Array_Counter_Firma - 9,0]

dem entspricht der Wert -> 'A. Berger GmbH & Co. KG,90751'

Ich möchte mir aber nur den Wert 'A. Berger GmbH & Co. KG' in eine Variable schreiben, aber wie komme ich an den ersten Wert des Arrays...?


THX
WEBSTER

_________________
Wer etwas anders macht, aber nicht besser, der sollte besser etwas anderes machen.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 11:47 
array_firmen[0,1] oder array_firmen[1,0] ?

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
WEBSTER Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mi 27.04.05 11:54 
Salute,

die Reihenfolge [Inhaltspositionen] sind doch erst mal nebensächlich. Es gaht ja darum einzelne Werte aus einem Array rauszuholen.


WEBSTER

_________________
Wer etwas anders macht, aber nicht besser, der sollte besser etwas anderes machen.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 11:57 
`das vorher war keine frage, sondern die antwort.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
WEBSTER Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mi 27.04.05 12:24 
Salute,

vielleicht haben wir uns etwas mißverstanden.

Das Array ist so gefüllt:


ausblenden Quelltext
1:
2:
3:
4:
5:
6:
array_firmen[0,0]  -> 'A. Berger GmbH & Co. KG,90751' 
array_firmen[0,1]  -> 'A. Berger GmbH & Co. KG,97231' 
array_firmen[0,2]  -> 'A. Berger GmbH & Co. KG,98975' 
array_firmen[1,0]  -> 'Mülller KG,20751' 
array_firmen[1,1]  -> 'Mülller KG,47231' 
array_firmen[1,2]  -> 'Mülller KG,58975'


Und ich möchte mir in einer Schleife folgenden Wert ermitteln...zb

ausblenden Delphi-Quelltext
1:
2:
3:
4:
for I:= 0 to 9 do
begin
ShowMessage(array_firmen[I,1]);
end;


Jetzt würde in dem ShowMessage aber 'A. Berger GmbH & Co. KG,90751' stehen...

Ich möchte aber im ShowMessage aber nur 'A. Berger GmbH & Co. KG' stehen haben.......


WEBSTER

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.

_________________
Wer etwas anders macht, aber nicht besser, der sollte besser etwas anderes machen.
Tastaro
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 414
Erhaltene Danke: 23



BeitragVerfasst: Mi 27.04.05 12:34 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
for I:= 0 to 9 do  
begin  
ShowMessage(copy(array_firmen[I,1], 1, pos(',', array_firmen[I,1]) - 1);  
end;


Beste Grüße
Tastaro

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mi 27.04.05 12:35 
wie wäre es mit sowas:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
type
  TFirma = record
    name : string;
    nummer: integer;
  end;

var 
  firmen: array of TFirma;
  i,l:integer;

begin
  L := 9;
  setlength(firmen,L);
  for i := 0 to L - 1 do begin
    firmen[i].name := 'ACME Company';
    firmen[i].nummer := i;
  end;
  showmessage(firmen[3].name);
end;

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...