> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/string/startswith.md).

# \_.startsWith（检查开头字符串）

**语法：**

```javascript
_.startsWith([string=''], [target], [position=0])
```

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

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

**描述：**

检查字符串`string`是否以`target`开头。

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

**参数：**

* `[string=''] (string)`: 要检索的字符串。
* `[target] (string)`: 要检查的字符串。
* `[position=0] (number)`: 检索的位置。

**返回值：**

* `(boolean)`: 如果string以 target，那么返回true，否则返回 false 。

**例子：**

```javascript
_.startsWith('abc', 'a');
// => true

_.startsWith('abc', 'b');
// => false

_.startsWith('abc', 'b', 1);
// => true
```
