Skip to content

Whitespace Clean API

POST https://api.findutils.com/api/tools/whitespace-clean/execute

Clean whitespace in text: trim the ends, trim each line, collapse runs of spaces, remove blank lines, and normalize line endings.

Request body

application/json
  • text

    string required

    Text to clean.

  • trim

    boolean optional

    Trim leading/trailing whitespace from the whole text. Defaults to true. Default true.

  • trim_lines

    boolean optional

    Trim each line on its own. Defaults to false. Default false.

  • collapse_spaces

    boolean optional

    Collapse runs of non-newline whitespace to a single space. Defaults to true. Default true.

  • remove_blank_lines

    boolean optional

    Drop lines that are only whitespace. Defaults to false. Default false.

  • normalize_newlines

    boolean optional

    Convert CRLF and CR to LF. Defaults to true. Ignored when line_ending is set. Default true.

  • line_ending

    string optional

    Which line ending to write: "lf", "crlf", "cr", or "keep" to leave them alone. Overrides normalize_newlines. One of keep · lf · crlf · cr.

Example arguments

Verified
{
  "text": "  hello   world  "
}