Text Tools

Trim Lines

Live

Remove leading and trailing whitespace from every line.

About Trim Lines

Remove leading and trailing whitespace from every line. Enter text in a purpose-built trim lines interface designed for this subject. Leading and trailing Unicode whitespace is removed from each line independently. The result includes result, changes, lines, supporting detail, and clear units or diagnostics. Results depend on the entered assumptions, units, and rounding. Review important decisions against authoritative requirements. Processing stays in your browser, and UtilityPages does not store the values you enter.

Set up Trim Lines

Workspace

Source workbench

Edit the source fields below and inspect the rendered output alongside your work.

This workspace updates as you edit.

Enter text.

Trim Lines result

Enter the values above, then transform to see a detailed result.

How Trim Lines works

Leading and trailing Unicode whitespace is removed from each line independently.

How it works

Leading and trailing Unicode whitespace is removed from each line independently. Results depend on the entered assumptions, units, and rounding. Review important decisions against authoritative requirements.

Examples

Trim Lines worked example

Example input
{
    "source": "  first line  \n\tsecond line\t\n third line "
}
Expected result
{
    "result": "first line\nsecond line\nthird line",
    "change_count": 3,
    "line_count": 3
}

Privacy

This tool does not store your inputs or results on UtilityPages.org.

Frequently asked questions

How does the Trim Lines work?

Leading and trailing Unicode whitespace is removed from each line independently.

What information should I enter?

Enter text. Use values and units from the same scenario so the result is internally consistent.

What results does this tool provide?

It reports result, changes, lines, including intermediate context where it helps you review the answer.

What limitations should I know about?

Results depend on the entered assumptions, units, and rounding. Review important decisions against authoritative requirements.