# \_.padStart（左侧填充字符）

**语法：**

```javascript
_.padStart([string=''], [length=0], [chars=' '])
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L14442)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.padstart)

**描述：**

如果`string`字符串长度小于`length`则在左侧填充字符。 如果超出`length`长度则截断超出的部分。

**开始版本：**&#x34;.0.0

**参数：**

* `[string=''] (string)`: 要填充的字符串。
* `[length=0] (number)`: 填充的长度。
* `[chars=' '] (string)`: 填充字符。&#x20;

**返回值：**

* `(string)`: 返回填充后的字符串。

**例子：**

```javascript
_.padStart('abc', 6);
// => '   abc'

_.padStart('abc', 6, '_-');
// => '_-_abc'

_.padStart('abc', 3);
// => 'abc'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lodash.shujuwajue.com/string/padstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
