📊 Text Line Sorter
📐 工作原理與說明
排序規則:Intl.Collator(zh) 本地化比較,大小寫敏感時 sensitivity = case、否則 base,自然排序開 numeric;支援升 / 降 / 長度升降 / 按行內首個數字升降 / Fisher-Yates 隨機洗牌 / 行序反轉;可選去空行與去首尾空白
Sort text lines alphabetically, numerically or by length in ascending or descending order with optional deduplication for rosters, parameter tables and log entries.
📚 深度解析:文本排序
💡 常見使用場景
- 名單與字典序:把無序列表按拼音/字母升序排,便於查閱。
- 資料預處理:排序後便於去重與比對差異。
- 展示規整:把標籤/關鍵詞排成穩定順序。
中文名單拼音排序
輸入「張三/李四/王五」,按拼音升序得「李四/王五/張三」(L/W/Z),輸出穩定可讀;中文按拼音而非筆畫,更符合搜尋習慣。
❓ 常見問題(FAQ)
- 數字怎麼排?
- 預設按字元(「10」會排在「2」前);需按數值大小排請用「自然排序/高階排序」,把 10 排在 2 之後。
- 升序降序都可?
- 可。降序即反轉結果;中英文混排建議先統一或選對應排序規則。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Code point order | code point ordering is stable but differs from human reading order | Unicode UTS #10, collation algorithm |
| Stability | a stable sort preserves the relative order of equal elements | Unicode UTS #10, collation algorithm |
| Dedup option | sorting enables merging adjacent duplicates in a single pass | IEEE 1003.1, POSIX text files |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準