Sort Lines API

Category: text

Sort lines of text alphabetically, numerically, by length, or in reverse. Runs entirely in the browser.

Endpoint

N/A Browser API (JavaScript)
No Server API

Response

Content-Type: N/A

This tool sorts text lines in the browser using JavaScript. No server-side API is available.

// Browser-only: lines are sorted using Array.sort()

cURL Example

# No cURL equivalent — this tool runs in the browser

Code Samples

// Sort lines alphabetically
const lines = text.split('\n');
lines.sort((a, b) => a.localeCompare(b));
const sorted = lines.join('\n');
# Sort lines alphabetically
lines = text.split('\n')
lines.sort()
sorted_text = '\n'.join(lines)
// Sort lines alphabetically
List<String> lines = Arrays.asList(text.split("\n"));
Collections.sort(lines);
String sorted = String.join("\n", lines);