You need to sign in to do that
Don't have an account?
Nitish Singh 22
How to sort alphanumeric data in Apex
I have data in the format 7.5.100.1225", "7.5.100.2736", "7.5.100.05286", "2018.1.3", "2018.1.1", "2", "10", "1", "2018.5.3".
I want to sort them. Any ideas ???
I want to sort them. Any ideas ???
Below sample code can fullfill your requirements. Hope this will work for you.
List<String> lstStr = new List<String>{'7.5.100.1225', '7.5.100.2736', '7.5.100.05286', '2018.1.3','2018.1.1','2','1','10','2018.5.3'};
lstStr.sort();
System.debug('Sorted List::'+ lstStr);
Please mark this as best answer if this solves your problem.
Thank you
Ajay Dubedi