Solved

Best way to access a list of items?

Posted on 1998-08-10
1
120 Views
Last Modified: 2010-04-04
I need to be able to save a list of about 300 - 600 filenames(names will get added and removed). I'll need to be able to search this list for matching files. What would be the best method to get this done? Save the filenames to a text file and then load them into an array, use a database, ini file, or what. I'm not sure which is best.

Thanks
0
Comment
Question by:evel
1 Comment
 
LVL 4

Accepted Solution

by:
erajoj earned 50 total points
ID: 1361854
Hi,
Use a TStringList, it's easiest.

var
  MyList: TStringList;
  iIndex: iIndex;
.
  MyList := TStringList.Create;
  MyList.Sorted := True; // optional
  MyList.Add( Filename1 );
  MyList.Add( Filename2 );
  MyList.Add( Filename3 );
  for iIndex := 1 to MyList.Count-1 do begin // only on sorted list!!!
    if CompareText( MyList[ iIndex ], MyList[ iIndex - 1 ] ) = 0
    then ... // found duplicate!
  end;
  MyList.SaveToFile( 'MyFiles.txt' ); // save list to file
  MyList.LoadFromFile( 'MyFiles.txt' ); // load list from file
  MyList.Free; // destroy list

That's it!

/// John

0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Communication Between RC4 Delphi <-> PHP 3 115
Delphi...Split view - idea? 1 68
how to change, disabled button color FMX ? 1 33
Tidtcpserver listening on multiports? 1 27
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question