?
Solved

TStringList and data values(algorithme)

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

762 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