Sort a Small Review List and Decide What Duplicates Mean
Use String Tools Line Sorter on fictional entries, test trimming and uniqueness separately, and preserve the original order before copying results.
By DevSphere Editorial · · 5 min read
Open String ToolsPrepare one-item-per-line input
A short list copied from meeting notes or a draft checklist can be easier to review alphabetically, but sorting can also remove distinctions that matter. Open String Tools and choose Line Sorter. Paste a safe fictional list into Input (one item per line), keeping the original in its approved note before trying any option that trims or deduplicates entries. The Sorted Output appears automatically, so you can test the effect of controls without changing the source text itself.
The sorter provides Ascending (A-Z) and Descending (Z-A), Numeric Sort, Remove Duplicates, and Trim. By default, Trim is enabled, while unique and numeric sorting are off. Empty lines are filtered out before the output is built. Those defaults can be convenient for a clean list, but they also mean the initial result may not preserve blank rows or leading and trailing spaces.
Input (one item per line)\n pear\napple\npear\n\nplum\n\nExpected with Trim on and duplicates retained\napple\npear\npear\nplum
Choose sorting behavior deliberately
Ascending and descending use locale-aware string comparison after converting each value to lowercase, so the order is case-insensitive for ordinary text. The output retains the original casing of each line even though the comparison uses lowercase copies. Numeric Sort instead parses a floating-point number from each line; nonnumeric values are treated like zero. This is helpful for a clean numeric list, but mixing labels and numbers can result in a confusing order that does not match natural-language expectations.
Try `item 2`, `item 10`, and `item 3` with Numeric Sort on to see the limitation. Each entire line is passed to parseFloat, so those strings are not parsed as numeric suffixes; they effectively compare as zero. For natural sorting of embedded numbers, use a specialized sorter. Do not assume this checkbox understands version numbers, dates, decimal locale conventions, or units.
Decide whether duplicates are errors
Remove Duplicates uses exact string identity after optional trimming. If Trim is enabled, two lines that differ only by leading or trailing spaces become the same entry before the Set removes duplicates. The first occurrence is kept, then the remaining unique lines are sorted. With Trim disabled, surrounding spaces can prevent two otherwise identical lines from being considered duplicates, although blank lines are still filtered from the final list.
A duplicate can be accidental, but it can also represent two distinct records with the same label. If identity matters, a plain text line is not enough to decide which entries should merge. Keep the original data and review duplicate occurrences before enabling removal. The sorter does not show a count of removed items or tell you which original row was retained; it simply returns the sorted list.
Verify output before copying it
Use a small list with one intentional duplicate, one blank line, and one whitespace-padded item. Observe the output first with default settings, then toggle Trim and Remove Duplicates individually. This isolates the effect of each option. Check that the line count and values match your intended transformation. Use the Copy button only after reviewing the Sorted Output; it is disabled when there is no nonempty output.
Copy places the sorted list on the clipboard, but there is no undo, export file, or separate generated history. Paste into a scratch area first when the list is important, compare it against the original, and only then replace any source list. If ordering itself carries meaning, sorting may destroy that order even if every line remains present. Keep an unsorted original and note the chosen options when reproducibility matters.
Numeric probe\nInput\n10\n2\n-1\n\nNumeric Sort ascending output\n-1\n2\n10\n\nThis numeric-only list is appropriate for the numeric option.
Troubleshoot surprising order
If lines appear in an unexpected order, first check whether Numeric Sort is enabled. A malformed number may parse as zero, and a string with a numeric prefix may be partially parsed. If ordinary alphabetical order seems case-sensitive, confirm the visible result and remember that lowercased copies are used for comparison while original text is displayed. Locale-specific alphabetization can also differ from a language's dictionary rules.
If an item is missing, check whether it was blank or consisted only of spaces, since empty lines are removed. Check whether Trim and Remove Duplicates are active and whether the same item appeared earlier. The sorter's one-input state can be shared with other String Tools subtools; inspect the current Input (one item per line) before diagnosing. There is no recovery for removed duplicates other than restoring the original text.
Use a structure-aware workflow for real records
Line Sorter operates on text lines and does not parse CSV columns, JSON objects, addresses, identifiers, or spreadsheet cells. Sorting a multi-column row will compare its entire textual representation. It cannot preserve a record's relationship to metadata unless each full record is on one line, and even then it does not understand which field should define order. Use the appropriate spreadsheet or data-processing tool when records have structure or a required stable key.
For a small plain-text checklist, the workflow is simple: preserve the original, choose direction, test trimming and uniqueness with a sample, inspect every output line, then copy to the intended destination. For a consequential inventory, verify counts and identity through a structured source. The tool is fast because it makes few assumptions; those same limits mean the user must decide what counts as a duplicate and whether alphabetical or numeric order is meaningful.