Solved

ListBox sorting

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 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