Text trailing whitespace trim
text-trailing-whitespace-trim · version 1.0.0 · Text · free, no key needed
Remove trailing whitespace from each line in a text.
Use when you need to: text trailing whitespace trim · trim trailing whitespace · remove trailing whitespace.
Supported
- text trailing whitespace trim
- trim trailing whitespace
- remove trailing whitespace
Not supported
- trim leading whitespace
- normalize line endings
- read files
Behavior
- Trailing whitespace (spaces and tabs) is removed from each line before the line ending (or EOF).
- Only \t and space characters are considered trailing whitespace. Form feeds, vertical tabs or other Unicode spaces are not stripped.
- Line endings (CRLF, CR, LF) are preserved.
- Returns the modified text and the number of lines that were altered.
Input
text(string, required): max length 1048576
Output
text(string, required): max length 1048576trimmed_lines(integer, required): min 0
Limits
- max text bytes: 1048576
- max output bytes: 1048576
Example
Request input:
{
"text": "a \n b\t\r\nc "
}
Response:
{
"result": {
"text": "a\n b\r\nc",
"trimmed_lines": 3
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-trailing-whitespace-trim",
"version": "1.0.0",
"input": {
"text": "a \n b\t\r\nc "
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-trailing-whitespace-trim/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"a \n b\t\r\nc "}'
The machine-readable contract is at /v1/tools/text-trailing-whitespace-trim/versions/1.0.0.
CLI
node cli.mjs run text-trailing-whitespace-trim 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Text lines multiset subtract: Multiset subtract b from a: remaining counts, first-seen order from a.
- Text strip BOM: Remove one leading U+FEFF byte-order mark from a Unicode string.
- Text apply unified patch: Apply a one-file unified patch to text at original line addresses with exact hunk matches.
- Text conflict parse: Parse merge or diff3 conflict-marker text into ordered text and conflict parts.
- Text conflict render: Render text and conflict parts as merge or diff3 conflict-marker text.
- Text control characters find: Find non-whitespace control characters in a text string.