🔤 文本排序工具

在线文本排序,按字母升序/降序/长度排序。免费工具。

分享: 🐦 Twitter 📘 Facebook

相关工具

关于此工具

在线文本排序,按字母升序/降序/长度排序。免费工具。

使用方法

工具网络

ToolfastproSkillgohubSmarttoolgoBesttoolfun
function initTool() { document.getElementById('tool-app').innerHTML = '
';
}
function doIt() {
  var lines = document.getElementById('inp').value.split(String.fromCharCode(10));
  var o = document.getElementById('order').value;
  if (o === 'asc') lines.sort(function(a,b){return a.localeCompare(b);});
  else if (o === 'desc') lines.sort(function(a,b){return b.localeCompare(a);});
  else if (o === 'len') lines.sort(function(a,b){return a.length-b.length;});
  else lines.sort(function(a,b){return b.length-a.length;});
  document.getElementById('out').textContent = lines.join(String.fromCharCode(10));
}
function clearAll() { document.getElementById('inp').value = ''; document.getElementById('out').textContent = ''; }
window.addEventListener('DOMContentLoaded', initTool);





n