Solved

TStringList and data values(algorithme)

Posted on 2003-11-27
2
260 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now