Skip to content

trim

Trim whitespace from a string.

Usage

js
import { trim } from 'js-cool'

Signature

typescript
function trim(string: string): string

Parameters

ParameterTypeDescription
stringstringThe string to trim

Returns

string - The trimmed string.

Examples

js
trim('  hello  ') // 'hello'
trim('\nhello\n') // 'hello'

Released under the MIT License.