Toolbox-XToolbox-X

Trim String(s)

Removes unnecessary spaces from a string or an array of strings.

trimString

The trimString function removes unnecessary leading, trailing, and multiple consecutive inner spaces from a string or recursively from an array of strings.

Function Signatures

function trimString(input: string): string
function trimString(input: string[]): string[]

Parameters

  • input (string | string[]): A string or an array of strings to trim.

Return Value

  • string | string[]: The trimmed string or array of strings.

Example Usage

playground.ts

Last updated: Sun, Jun 14, 2026 07:31:07PM (UTC)

On this page