Options
All
  • Public
  • Public/Protected
  • All
Menu

Module trim

Index

Functions String

String Functions

  • trim(str: string, chars: string, guard?: any): string
  • Removes leading and trailing whitespace or specified characters from string.

    since

    5.6.0

    see

    trimEnd,trimStart

    example
    trim('  abc  ')
    // => 'abc'

    trim('-_-abc-_-', '_-')
    // => 'abc'

    Parameters

    • str: string

      The string to trim.

    • chars: string

      The characters to trim.

    • Optional guard: any

    Returns string

    Returns the trimmed string.