[Solved] How to sort string by number? [closed]


You can sort an array using the Array.Sort Method. Assuming that each string in the array matches ^\d+\..*$, all you need to do is extract the digits, parse them to integers and compare the values:

Array.Sort<string>(array, (x, y) => 
    int.Parse(x.Substring(0, x.IndexOf('.'))) - 
    int.Parse(y.Substring(0, y.IndexOf('.'))));

7

solved How to sort string by number? [closed]