ModelWorks logoModelWorks
JSON TransformString

trimStart

Remove leading whitespace from a string

trimStart

Removes leading whitespace from a string. Trailing whitespace is preserved.

Options

This operation takes no options; pass an empty object or omit options entirely.

Example

Input

JSON
"   hello   "

Operation

JSON
{ "type": "trimStart" }

Output

JSON
"hello   "

In a Circuit Step

JSON
{
  "name": "trim_leading_indent",
  "description": "Strip leading whitespace from a code block string",
  "function": "circuit.core.transform.json",
  "input": {
    "source": "${{ input.code_block }}",
    "operations": [
      { "type": "trimStart" }
    ]
  },
  "outputs": [
    {
      "name": "left_trimmed",
      "description": "Code block with leading whitespace removed",
      "value": "${{ trim_leading_indent.output.transformed_result }}"
    }
  ]
}

Notes & gotchas

  • Errors with trimStart: expected string if the input is not a string.
  • "Whitespace" follows Rust's Unicode-aware definition.
  • Use trim to strip both ends or trimEnd for the trailing side.
On this page

On this page