[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

TStringList and data values(algorithme)

Posted on 2003-11-27
2
Medium Priority
?
267 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 150 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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