Function: trim

trim(str, type?): string

清除空格

Parameters

Name Type Default value Description
str string undefined 需要处理的字符串
type 1 | 2 | 3 | 4 1 处理类型:1-所有空格 2-前后空格 3-前空格 4-后空格

Returns

string

处理后的字符串

Example

trim(' 123 ');
// => '123'
ON THIS PAGE