Solved

ListBox sorting

Posted on 1998-06-23
1
353 Views
Last Modified: 2010-04-04
I need a ListBox that is sorted by third character of Items, not by first. Any way to obtain this?
0
Comment
Question by:bor061297
1 Comment
 
LVL 2

Accepted Solution

by:
kjteng earned 50 total points
ID: 1355485
The following is a procedure to sort from n-thcharacter of item:

procedure mySort( lb: tListBox; n: integer);
var i: longint;  s: string;
begin
  with lb do begin
    sorted:= false;
    for i:= 0 to items.Count-1 do begin
      s:= items[ i];
      items[ i]:= copy( s, n, length(s))+ copy( s, 1, n-1);
    end; {for}
    sorted:= true;
    sorted:= false;
    for i:= 0 to items.Count-1 do begin
      s:= items[ i];
      items[ i]:= copy( s, length( s)-n+2, length(s))
                  + copy( s, 1, length(s)-n+1);
    end; {for}
  end; {with}
end;

0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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