Solved

TStringList and data values(algorithme)

Posted on 2003-11-27
2
264 Views
Last Modified: 2010-04-05
Hi

I have a TStringList called sFirm.

In the stringList I have for example these values:
sFirm[0]:='firm1';
sFirm[1]:='firm2';
sFirm[2]:='firm3';
sFirm[3]:='firm4';
sFirm[4]:='firm2';
sFirm[5]:='firm1';
sFirm[6]:='firm6';
.
.
.

I want to pull out the uniq firm once and put it on another stringList(or the same stringList, but the important is not to have two same firm as firm1 and frim2).

So the list I want to get is:
sTmp[0]:='firm1';
sTmp[1]:='firm2';
sTmp[2]:='firm3';
sTmp[3]:='firm4';
sTmp[4]:='firm6';
.
.
.

Thanks for your help.

Cheers
mha
0
Comment
Question by:michaenh
[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
2 Comments
 
LVL 9

Accepted Solution

by:
mocarts earned 50 total points
ID: 9830467
hi, mha :)
all that you need is already implemented by TStringList:

var
  i: integer;
  sTmp: TStringList;
begin
  sTmp := TStringList.Create;
  sTmp.Sorted := True;
  sTmp.Duplicates := dupIgnore;  // ignore duplicate insertion attempts
  for i := 0 to sFirm.Count -1 do
    sTmp.Add(sFirm[i]);
end;

now you got string list with uniquie firms list

wbr, mo.
0
 

Author Comment

by:michaenh
ID: 9830507
Yes..

I just found the solutuion too.. :)

cheers,
mha
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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