Scenario
We all know that trying to sort numbers alphabetically ends up with things like
123, 234, 5, 76, 9
But let's say you have a list of strings that look something like
123 Some title
234 Another title
5 More title
76 Titles abound
9 Last title
and you want it sorted by the size of the number in the first word of each title.
Expected result
5 More title
9 Last title
76 Titles abound
123 Some title
234 Another title
Question
Is there a nice way to sort this way, either by going via a different data structure, or otherwise?
Details
I entertained the thought of turning into some sort of dict or associated array such as
5: More title,
//...
but the numbers aren't necessarily unique for my use-case.