Skip to content

trimStart

js
_.trimStart([string=''], [chars=whitespace])

string 中删除前导空格或指定字符。

¥Removes leading whitespace or specified characters from string.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. [string=''] (字符串):要修剪的字符串。

    ¥[string=''] (string): The string to trim.

  2. [chars=whitespace] (字符串):要修剪的字符。

    ¥[chars=whitespace] (string): The characters to trim.

返回

¥Returns

(字符串):返回修剪后的字符串。

¥(string): Returns the trimmed string.

示例

¥Example

js
_.trimStart('  abc  ');
// => 'abc  '

_.trimStart('-_-abc-_-', '_-');
// => 'abc-_-'

Lodash v4.17 中文网 - 粤ICP备13048890号