How to arrange ages in ascending order dynamically 0-30 181-365 31-60 365-700 91-180
in this format.
Input = New List(Of String) From {β0-30β, β181-365β, β31-60β, β365-700β, β91-180β}
Order = Input.OrderBy(Function(range) Convert.ToInt32(range.Split("-"c)(0))).ToList()
Output = String.Join(β,β, Order)
If you found helpful, feel free to tick as a solution.
Happy Automation
Column data should also change the index
Yes, since the data is now sorted in ascending order, the index positions have changed accordingly. If the index is being used for any reference or mapping, it should be updated to match the new order.
Happy Automation
Please try this
Say you are getting a string in the above given format
Str.split(" "c).OrderBy(function(x) cint(x.split("-"c).First)).Toarray
this will give array of strings in ascending order
Cheers