Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Bubble sort


'sort Info Array
'Remove the LCase$ if you don't want to ignore Case
'reverse the > if you want a descending sort
For i = 0 To Ubound (Info) - 1
    For j = i + 1 To Ubound (Info)
        If Lcase $(Info(i)) > Lcase $(Info(j)) Then
            'swap places
           temp = Info(i)
           Info(i) = Info(j)
           Info(j) = temp
         End If
    Next j
Next