Best way to sort...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a string array full of values like this:

05 00 0A 5E 4C 40 40
03 00 C0 9F 27 60 57
08 00 C0 9F 36 71 35
01 00 0A 5E 4E 40 13

I want to sort them in an ascending fashion based on the two left-most
numbers, such as 05, 03, 08 and 01. What is the best way I should try to do
this?
 
Perhaps is not the best way, but is the easier way in this context:

Array.Sort(YourArray)

[]s

Cesar
 
I should add that I have declared my array as such:

Dim MACList(23) As String

So the SORT won't work...




ronchese said:
Perhaps is not the best way, but is the easier way in this context:

Array.Sort(YourArray)

[]s

Cesar


Military Smurf said:
I have a string array full of values like this:

05 00 0A 5E 4C 40 40
03 00 C0 9F 27 60 57
08 00 C0 9F 36 71 35
01 00 0A 5E 4E 40 13

I want to sort them in an ascending fashion based on the two left-most
numbers, such as 05, 03, 08 and 01. What is the best way I should try to
do
this?
 
I have coded like that and worked:


Dim arr(3) As String
arr(0) = "05 00 0A 5E 4C 40 40"
arr(1) = "03 00 C0 9F 27 60 57"
arr(2) = "08 00 C0 9F 36 71 35"
arr(3) = "01 00 0A 5E 4E 40 13"
Array.Sort(arr)

I debugged that and the array was sorted.




Military Smurf said:
I should add that I have declared my array as such:

Dim MACList(23) As String

So the SORT won't work...




ronchese said:
Perhaps is not the best way, but is the easier way in this context:

Array.Sort(YourArray)

[]s

Cesar


Military Smurf said:
I have a string array full of values like this:

05 00 0A 5E 4C 40 40
03 00 C0 9F 27 60 57
08 00 C0 9F 36 71 35
01 00 0A 5E 4E 40 13

I want to sort them in an ascending fashion based on the two left-most
numbers, such as 05, 03, 08 and 01. What is the best way I should try to
do
this?
 
Maybe I should have been more clear-the sorting MAY work, but I do not know
how to retrieve the sorted values. Using your example:

MsgBox(arr(0)) doesn't display the first element, so I don't know how to get
the newly sorted values.





ronchese said:
I have coded like that and worked:


Dim arr(3) As String
arr(0) = "05 00 0A 5E 4C 40 40"
arr(1) = "03 00 C0 9F 27 60 57"
arr(2) = "08 00 C0 9F 36 71 35"
arr(3) = "01 00 0A 5E 4E 40 13"
Array.Sort(arr)

I debugged that and the array was sorted.




Military Smurf said:
I should add that I have declared my array as such:

Dim MACList(23) As String

So the SORT won't work...




ronchese said:
Perhaps is not the best way, but is the easier way in this context:

Array.Sort(YourArray)

[]s

Cesar


I have a string array full of values like this:

05 00 0A 5E 4C 40 40
03 00 C0 9F 27 60 57
08 00 C0 9F 36 71 35
01 00 0A 5E 4E 40 13

I want to sort them in an ascending fashion based on the two left-most
numbers, such as 05, 03, 08 and 01. What is the best way I should try to
do
this?
 
Actually I just got it working. I must have been brain dead yesterday and
didn't know it.

Thanks




Military Smurf said:
Maybe I should have been more clear-the sorting MAY work, but I do not know
how to retrieve the sorted values. Using your example:

MsgBox(arr(0)) doesn't display the first element, so I don't know how to get
the newly sorted values.





ronchese said:
I have coded like that and worked:


Dim arr(3) As String
arr(0) = "05 00 0A 5E 4C 40 40"
arr(1) = "03 00 C0 9F 27 60 57"
arr(2) = "08 00 C0 9F 36 71 35"
arr(3) = "01 00 0A 5E 4E 40 13"
Array.Sort(arr)

I debugged that and the array was sorted.




Military Smurf said:
I should add that I have declared my array as such:

Dim MACList(23) As String

So the SORT won't work...




:

Perhaps is not the best way, but is the easier way in this context:

Array.Sort(YourArray)

[]s

Cesar


I have a string array full of values like this:

05 00 0A 5E 4C 40 40
03 00 C0 9F 27 60 57
08 00 C0 9F 36 71 35
01 00 0A 5E 4E 40 13

I want to sort them in an ascending fashion based on the two left-most
numbers, such as 05, 03, 08 and 01. What is the best way I should try to
do
this?
 
Back
Top