in my datagridview column is containing alphabets and numbers. i want to sort my datagridview column numbers after ending last alphabet.
ex: i want this order
ka07dh8342
ap16as4779
ap16as4778
ta5hk1234 ta5hk1233
how can i write the code for this?
Jignesh TrivediPosted Jun 19, 2012, 5:33 AM
I think you can easy done with LINQ
for example you have list of string
List
mydata.Add("ka07dh8342");
mydata.Add("ap16as4779");
mydata.Add("ap16as4778");
mydata.Add("ta5hk1234");
mydata.Add("ta5hk1233");
var mydata1 = from m in mydata
orderby int.Parse(Regex.Split(m, "[a-z]+|[A-Z]+").Last())
select m;
Result is
ta5hk1233
ta5hk1234
ap16as4778
ap16as4779
ka07dh8342
hope this will help you.
Jignesh TrivediPosted Jun 19, 2012, 4:02 AM
we required more info for your post.
If iam not wrong you want sort by last fout digit?
thx.