> 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/kebabcase.md).

# \_.kebabCase（以-连接字符串）

**语法：**

```javascript
_.kebabCase([string=''])
```

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

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

**描述：**

转换字符串`string`为[kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).

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

**参数：**

* `[string=''] (string)`: 要转换的字符串。

**返回值：**

* `(string)`: 返回转换后的字符串。

**例子：**

```javascript
_.kebabCase('Foo Bar');
// => 'foo-bar'

_.kebabCase('fooBar');
// => 'foo-bar'

_.kebabCase('__FOO_BAR__');
// => 'foo-bar'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/kebabcase.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.
