|
Post by Kelly Ethridge on Nov 5, 2006 12:12:56 GMT -5
String arrays can be easily sorted using the cArray.Sort method.
Dim a() As String a = NewStrings("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday") CorArray.Sort a
This will sort the array in ascending order. By default, the sorting method will perform binary comparisons on strings. If there are strings with mixed cases, then the sorting may be not as expected. To handle mixed case strings, use the StringComparer.OrdinalIgnoreCase comparer to perform the proper string comparisons.
Dim a() As String a = NewStrings("MONDAY", "tuesday", "WEDNESDAY", "thursday", "FRIDAY", "saturday", "SUNDAY") CorArray.Sort a, StringComparer.OrdinalIgnoreCase
This will perform a case insensitive sort on the string array.
|
|