Autor Beitrag
Stefan_B
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Mo 20.01.03 13:42 
hallo!
möchte eine stringliste aus "bearbeiter" erstellen. es sind ca. 27 drin ('AA' 'AH' usw.). möchte dafür aber, nicht wie unten, eine textdatei erstellen. sondern direkt die bearbeiterkürzel in den quelcode reinschreiben.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var
          SList: TStringList;
          begin
               SList:=TStringList.Create;
               SList.LoadFromFile('C:\test.txt');
               Showmessage(SList[2]);
               SList.Free;
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 20.01.03 13:47 
ausblenden Quelltext
1:
2:
3:
4:
5:
               SList:=TStringList.Create;
               slList.add('aa');
               slList.add('ah');

               Showmessage(SList[1]);

Schau dir die add-methode an
Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 20.01.03 13:48 
Hallo,

ich werde aus Deinem Posting nicht ganz schlau, aber ich hoffe einmal, dass Dir folgendes hilft:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
const
  iMaxBearbeiter=5;
  sBearbeiter:array[1..iMaxBearbeiter] of String=('AA', 'AH', 'BH', 'CD', 'FG');


var i:Integer;
    sList:TStringList;
begin
  SList:=TStringList.Create; 
  try
    for i:=1 to iMaxBearbeiter do sList.Add(sBearbeiter[i]);
    Showmessage(SList[2]); 
  finally
    SList.Free;
  end; // try
end;

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Stefan_B Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Mo 20.01.03 13:58 
danke smiegel!
Stefan_B Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Mo 20.01.03 14:02 
aber kann man das nicht auch ohne const machen?
mit commatext?
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Mo 20.01.03 15:00 
Hallo,
Stefan_B hat folgendes geschrieben:
aber kann man das nicht auch ohne const machen?

eine möglichkeit hat Keldorn dir doch gepostet.
Stefan_B hat folgendes geschrieben:
mit commatext?

Natürlich kanst du auch Commatext verwenden:
ausblenden Quelltext
1:
Stringlist.CommaText := 'aa,ah,ax, ...';					


Gruß
Klabautermann