Function trim

  • Removes leading and trailing whitespace or specified characters from string.

    Parameters

    • Optionalstring: string

      The string to trim.

    • Optionalchars: string

      The characters to trim.

    Returns string

    Returns the trimmed string.

    3.0.0

    trimEnd, trimStart

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

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