Developer & Data

Sort Text Naturally or by Numeric Value

Updated

The right order depends on what the lines represent. Item2 usually belongs before Item10 in a human list. In a strict character comparison, the ordering can be different. Numeric quantities need another rule again.

Open Text Line Sorter and choose the sort mode that matches your data. The tool returns reordered lines without converting them into a spreadsheet.

Choose the rule before judging the result

A natural sort of Item10, Item2 and Item1 gives Item1, Item2 and Item10. That is helpful for numbered labels, folders or equipment names.

A numeric sort of 10, 2 and 1 gives 1, 2 and 10. Use it for values rather than labels. A mixed line such as Rs 10 is not a plain numeric value and should be cleaned deliberately before that mode is used.

Lexical sorting uses UTF8 byte order. It is reproducible, but it is not a language aware Urdu or English dictionary collation. Do not interpret its placement of accented or non Latin characters as a linguistic judgement.

Keep connected information together

Every line is moved as a unit. If a name is on one line and its phone number is on the next, sorting will break the relationship. Put associated fields together or use a structured CSV workflow instead.

Ascending and descending choices change direction. Neither choice groups records by a hidden category or removes duplicates automatically.

Empty lines can affect the visible list, so inspect them before treating the output as a clean index. A sorted list is not necessarily a validated list.

Compare the first few and last few entries after processing. Those positions reveal most mistakes in the chosen mode, particularly when numeric labels are being mistaken for ordinary text or vice versa.

Join the conversation

Your email address will not be published. Required fields are marked *

Explore Whatson tool information