主题
_.trimEnd([string=''], [chars=whitespace])
_.trimEnd() 方法用于移除字符串末尾的空白字符(或其他指定的字符)。
参数
string(string): 要处理的字符串。chars(string): 要移除的字符,默认为空白字符。
返回值
(string): 返回处理后的字符串。
示例
javascript
const result = _.trimEnd(" Hello World ");
console.log(result);
// => ' Hello World'在这个示例中,字符串 ' Hello World ' 的末尾空白字符被移除,结果为 ' Hello World'。