Solved

TStringList and data values(algorithme)

Posted on 2003-11-27
2
257 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
Comment Utility
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
Comment Utility
Yes..

I just found the solutuion too.. :)

cheers,
mha
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

7 Experts available now in Live!

Get 1:1 Help Now