Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


Return to article

VBSort.wsc to the Rescue: VBScript No Longer Lacks an Array Sorting Method
 

Sorting an array is a common scripting task, but VBScript doesn't provide a native capability to do so. To fill this gap, Bill Stewart has written VBSort.wsc. This Windows script component implements the Penton.VBSort object, which provides three properties and a method that let you quickly sort VBScript arrays.

Bill discusses how to register and use VBSort.wsc in "Sorting Arrays in VBScript". He also presents a script, Sorter.vbs, that uses VBSort.wsc in "Using the Penton.VBSort Object to Sort Arrays". You can use Sorter.vbs to sort data in one file, then write the sorted data to another file. You can also use it to sort redirected lines of text. I opened up both articles for public viewing through May 1. If you enjoy reading these articles, you can get more of this type of content by subscribing to Scripting Pro VIP.







Reader Comments

I tried sorting a number of IP addresses and found a flaw. (see below) Unfortunately I can't offer a solution at this time. 172.25.1.1 172.25.1.10 172.25.1.100 172.25.1.109 172.25.1.11 172.25.1.110 172.25.1.119 172.25.1.12

mikewell -September 10, 2008

Hi mikewell, Your list is sorted alphabetically and so the algorithm is working correctly. To sort numerically, you could try importing your list into a spreadsheet. Bill

AbqBill -September 11, 2008
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement