主题
trimStart
js
_.trimStart([string=''], [chars=whitespace])
从 string
中删除前导空格或指定字符。
¥Removes leading whitespace or specified characters from string
.
新增于
¥Since
4.0.0
参数
¥Arguments
[string='']
(字符串):要修剪的字符串。¥
[string='']
(string): The string to trim.[chars=whitespace]
(字符串):要修剪的字符。¥
[chars=whitespace]
(string): The characters to trim.
返回
¥Returns
(字符串):返回修剪后的字符串。
¥(string): Returns the trimmed string.
示例
¥Example
js
_.trimStart(' abc ');
// => 'abc '
_.trimStart('-_-abc-_-', '_-');
// => 'abc-_-'