To sort a series of strings, you need a way to compare two strings to determine which is “less” and which is “more”. The lesser one comes before the greater one (or in an descending sort, after). Modern CSV uses a combination of numerical and lexicographical sort. Here is a super professional looking flow chart to show how it works: Lexicographical Sort Lexicographical sort is ill-suited for sorting numbers. If you have a series of numbers, say 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, and you apply a lexicographical sort, it’ll come up 1, 10, […]