function requireText(ctx, fieldName) {
var values = ctx.getValues();
var text = String(values[fieldName || "sourceText"] || "");
if (!text.trim()) {
ctx.setStatus("Add some text first so the tool has something to work with.", "warning");
return null;
}
return { values: values, text: text };
}
function analyzeText(text) {
var words = text.trim() ? text.trim().split(/\s+/).filter(Boolean).length : 0;
var lines = Common.splitLines(text);
var nonEmptyLines = lines.filter(function (line) {
return line.trim() !== "";
});
var sentences = text
.split(/[.!?]+/)
.map(function (item) {
return item.trim();
})
.filter(Boolean);
var paragraphs = text
.split(/\n\s*\n/)
.map(function (item) {
return item.trim();
})
.filter(Boolean);
return {
words: words,
characters: text.length,
charactersNoSpaces: text.replace(/\s/g, "").length,
lines: lines.length,
nonEmptyLines: nonEmptyLines.length,
sentences: sentences.length,
paragraphs: paragraphs.length,
readingMinutes: words / 200,
};
}
function naturalCompare(a, b, ignoreCase) {
var left = ignoreCase ? String(a).toLowerCase() : String(a);
var right = ignoreCase ? String(b).toLowerCase() : String(b);
return left.localeCompare(right, undefined, { numeric: true, sensitivity: "base" });
}
window.WLTPostTools.mountRenderedTool({
root: "#wlt-tool-text-sorter",
slug: "text-sorter",
name: "Text Sorter",
family: "text",
type: "tool",
implementation: implementation
});
}
start();
})();
[/wlt_inline_script]
Overview
About Text Sorter
Text Sorter is a browser-based text tool built for fast, no-sign-up workflows. With this page, you can sort text lines for lists, keywords, names, tags, and exported notes, review the result immediately, and keep moving without switching tabs.
Text Sorter is useful when copied text needs cleanup, structure, or quick transformation before you paste it into a document, spreadsheet, prompt, or CMS. It works well for writers, students, marketers, operations teams, and anyone who handles line-based content or repeated editing tasks.
How To Use
How to use Text Sorter
The fastest way to use Text Sorter is to enter your input, adjust only the settings you need, and run the main action once. After that, review the result panel, copy the output if necessary, and rerun the tool whenever you want to compare another version.
Paste one item per line to create a sortable list.
Choose ascending, descending, or natural sort behavior and decide whether case should matter.
Copy the sorted output when the list looks right.
Who Uses It
Who this page is for
This page is mainly useful for people who clean, compare, rewrite, or organize text during everyday work. The common pattern is simple: paste messy content in, get a cleaner output out, and move on without interrupting the rest of the workflow.
Writers, analysts, and teachers organizing names, words, or copied lists.
Anyone cleaning rough exports before moving them into spreadsheets or documents.
Helpful Tips
How to get better results
If your input is list-based, keep one item per line when possible so the output stays easier to review and reuse.
Use the copy or download action after each run when you want to compare multiple cleaned versions of the same text.
For longer passages, paste the content in one block first, then adjust options gradually so you can see exactly which change improved the result.
FAQ
Common questions
Yes. Natural sorting helps keep values like item2 and item10 in a more human order.