-
Couldn't load subscription status.
- Fork 0
ProtoString protoTrim() Method
Seth Clydesdale edited this page Jun 2, 2015
·
6 revisions
Trimming a string of whitespace on both sides.
' Hello world ! '.protoTrim(); // returns 'Hello world !'Passing left as the parameter will trim the left side of whitespace.
' Hello world ! '.protoTrim('left'); // returns 'Hello world ! 'Passing right as the parameter will trim the right side of whitespace.
' Hello world ! '.protoTrim('right'); // returns ' Hello world !'The protoTrim method can be used as a polyfiller for the native trim(), trimLeft(), and trimRight() methods. It's used to trim whitespace on a specific side, or both sides of a string.
String.protoTrim(type);| Parameter | Description |
|---|---|
| type | A string which determines the side of the string to be trimmed. Possible values are left, right, and both. Defaults to both if left undefined. |
Home • History • ProtoString • Created by Seth Clydesdale