📊 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)中使用
- 计算结果仅供参考,请以实际应用场景为准