Lexicographic sorting

Is this what you’re after?