Search for '{{search_term}}'

Exercise: sort mixed string

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

Exercise: sort mixed string

In a file we have the following strings: A1 B1 A27 A3 ... each string has a single letter at the beginning and then a number.

Sort them first based on the first letter and among values with the same leading letter sort them according to the numbers so the above values would be in the following order:

A1 A3 A27 B1 


A1 A27 C1 B1 B12 A38 B3 A3 


In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus