sorting - Sort an array of IPs in VB script -


i'm looking sort list of ip addresses using vb script. i've looked solutions in plenty of places if happens duplicate, welcome being marked one. i'm new using vbs syntax easy understand working solution or guideline do. seems tricky enough accomplish due vb not having committed sort function (or sub), ips being easy misinterpret. havn't tried such yet.

example:

123.123.123.123, 12.12.1.12, 23.34.56.11, 45.33.22.1, 1.3.5.55, 

to become

1.3.5.55, 12.12.1.12, 23.34.56.11, 45.33.22.1, 123.123.123.123 

by changing test data to

dim atests : atests = array( _   "123.123.123.123" _ , "12.12.1.12" _ , "23.34.56.11" _ , "45.33.22.1" _ , "1.3.5.55" _ ) 

and taking care of 4 elements in format:

alvers.add ofmt.formatarray("{0,4}.{1,4}.{2,4}.{3,4}", aparts) 

the technique/code here produced output:

123.123.123.123 12.12.1.12 23.34.56.11 45.33.22.1 1.3.5.55 ---------------    1.   3.   5.  55   12.  12.   1.  12   23.  34.  56.  11   45.  33.  22.   1  123. 123. 123. 123 --------------- 1.3.5.55 12.12.1.12 23.34.56.11 45.33.22.1 123.123.123.123 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -