I have a requirement to sort the values of a data table column. That column contains strings, integers or mixed texts. For example:
The data table column contains values like this: 23, 18, 12, store 23, store a1, 1283, 25, ...
If I sort the values by using Dataview.sort() method it results in this order: 12, 1283, 18, 23, 25, store 1283, store a1, ... but I need like this: 12, 18, 23, 25, 1283, store 23, store a1, ...
Is there any simple method for attaining this requirement?
I think you should use natural sorting and make your own IComparer
The best algo I found was here
http://www.davekoelle.com/files/AlphanumComparator.cs.
Just make it a generic class(as linq uses as Linq order by takes IComparer) , like following
Now to apply this, use linq
Result 12, 23, 1283, store 1283