can.trim

  • function
 

Trim whitespace off a string.

can.trim(str)

Parameters

  1. str {String}

    The string to trim.

Returns

{String}

The trimmed string.

can.trim(str) removes leading and trailing whitespace from a string. It will also remove all newlines, spaces including non-breaking, and tabs. If these occur in the middle of the string, then they will be persisted.

can.trim(" foo ") // "foo"