Skip to content

@technobuddha > library > String > Operations

Function: collapseWhitespace()

ts
function collapseWhitespace(input: string, trim: CollapseWhitespaceOptions): string;

Defined in: collapse-whitespace.ts:21

Replace all whitespace within a string with a single space

Parameters

ParameterTypeDescription
inputstringThe string
trimCollapseWhitespaceOptionsIf true, remove leading and trailing whitespace

Returns

string