S
Steve Long
Hello,
I am looking for some opinions the way that the:
string.Compare method returns results in the .NET Framework.
I'm building a strings object that inserts strings in sorted order so I
would like to know your expectations about this topic.
Example 1:
In the following, each line is a single string:
1
12
124
111
Using the string.Compare method "111" compares less than "12" so inserting
it into my object, the sort order is:
1
111
12
124
Example 2:
a
ab
abc
aaa
Again, string.Compare compares "aaa" less than "ab" so the sort order goes:
a
aaa
ab
abc
Is this behavior what you would expect and how you would use the
string.Compare method? It seems to me that "aaa" should be greater than "ab"
and that "111" should be greater than "12".
Your thoughts are much appreciated concerning how you would approach this.
Steve Long
I am looking for some opinions the way that the:
string.Compare method returns results in the .NET Framework.
I'm building a strings object that inserts strings in sorted order so I
would like to know your expectations about this topic.
Example 1:
In the following, each line is a single string:
1
12
124
111
Using the string.Compare method "111" compares less than "12" so inserting
it into my object, the sort order is:
1
111
12
124
Example 2:
a
ab
abc
aaa
Again, string.Compare compares "aaa" less than "ab" so the sort order goes:
a
aaa
ab
abc
Is this behavior what you would expect and how you would use the
string.Compare method? It seems to me that "aaa" should be greater than "ab"
and that "111" should be greater than "12".
Your thoughts are much appreciated concerning how you would approach this.
Steve Long