Solved

ListBox sorting

Posted on 1998-06-23
1
343 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

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…
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

21 Experts available now in Live!

Get 1:1 Help Now