[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Best way to access a list of items?

Posted on 1998-08-10
1
Medium Priority
?
126 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
erajoj earned 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 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