Skip to content

Mint.utils.trimString

Tania Shatilova edited this page Nov 10, 2015 · 1 revision

The trimString() method removes spaces from the beginning and the ending of the string but not from the middle of the string.

Syntax

var trimmedStr = Mint.utils.trimString("  Lorem impus ");

Parameters

  • value - string for trim.

Return Value

The string that remains after all spaces are removed from the start and end of the inner string.

Examples

Mint.utils.trimString("  Lorem impus ");                      // "Lorem impus"
Mint.utils.trimString("Lorem impus");                         // "Lorem impus"
Mint.utils.trimString("  Lorem   ipsum   dolor   sit amet");  // "Lorem   ipsum   dolor   sit amet"
Mint.utils.trimString("   ");                                 // ""
Mint.utils.trimString("");                                    // ""
Mint.utils.trimString(null);                                  // error
Mint.utils.trimString(12);                                    // error

Clone this wiki locally