Alphabetizer FUNCTION

 BBS: Inland Empire Archive
Date: 12-06-92 (22:23)             Number: 365
From: MARK REJHON                  Refer#: NONE
  To: SHANE HEADER                  Recvd: NO  
Subj: Alphabetizer FUNCTION          Conf: (2) Quik_Bas
 >         Does anyone have a FUNCTION that that will
 > alphabatize a complete
 > string array? I have tried unsucessfuly. I'm sure I could do
 > it, but I thought I would check with you guys to see if you had one
 > lying around.

The simplest sorting algorithm, for a 100 string array, non-case sensitive,
is listed below.  I assume that speed isn't important here.  <G>

  Swapped% = 0
  FOR StringNum% = 1 TO 99
    IF UCASE$(Array$(StringNum%)) > UCASE$(Array$(StringNum% + 1)) THEN
      SWAP Array$(StringNum%), Array$(StringNum% + 1)
      Swapped% = -1
  NEXT StringNum%

Mark Rejhon

--- FMail 0.92
 * Origin: +++ VIddIBBS +++ (613) 521-4486! (1:163/255)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET