JavaScript

$u.s.aTrim Function

Syntax

$u.s.aTrim(str as string [, chr as string])

Arguments

str string

The string that has extra whitespace to remove from the beginning or end.

chrstring

(Optional) Specifies the characters to remove from the string.

Description

Trim the both sides of a string, removing spaces and any passed in characters.

Example

var string1 = '    -   this string has a leading and trailing  dash and spaces   -    ';
string1 = $u.s.aTrim(string1,' -');
/*the resulting string is 'this string has a leading and  trailing dash and spaces'. The leading and trailing spaces and - have been  removed.*/