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


April 04, 2008

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

RSS
Subscribe to Windows IT Pro | See More News and Analysis Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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.

End of Article



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 (Article Rating: )


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 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
What You Need to Know About Microsoft's x64 Server Product Plans

What do Longhorn Server, Windows Compute Cluster Server, and Windows Vista have in common? The x64 platform. ...

WinInfo Short Takes: 4th of July Special Edition

An often irreverent look at some of the week's other news, including a shortened work week thanks to the 4th of July, expensive Windows 7 pricing, Bing's modest monthly gains, IE 8 heading to work, Steve Jobs back at Apple, and so much more ...

How can I stop and start services from the command line?

...


Related Events WinConnections and Microsoft® Exchange Connections

Check out our list of Free Email Newsletters!

News and Analysis eBooks Getting Maximum Performance from Your Web-based Applications

Business Process Automation - Managing Cost in Your Enterprise

Keeping Your Business Safe from Attack: Encryption and Certificate Services

Related News and Analysis Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format

Test Drive IT Solutions and Get Free Music Downloads
Solve your toughest IT problems with these free downloads and receive 5 free music downloads!


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 ITTV
IT Library Technology Resource Directory Connected Home asp.netPRO Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement | Reprints and Licensing