---
title: "camelCase"
description: "将字符串转换为驼峰式 (helloWorld)。"
seo_title: "camelCase"
seo_description: "Convert a string to camelCase, lowercasing the first word and capitalizing the rest, with no separators between joined words."
canonical_url: "https://core.mhaibaraai.cn/docs/transformers/string/camel-case"
---
# camelCase

> 将字符串转换为驼峰式 (helloWorld)。

## 用法

将字符串转换为驼峰命名格式（第一个单词小写，后续单词首字母大写）。

```ts
import { camelCase } from '@movk/core'

camelCase('First Name') // => 'firstName'
camelCase('first_name') // => 'firstName'
camelCase('first-name') // => 'firstName'
camelCase('XMLHttpRequest') // => 'xmlHttpRequest'
```

## API

`camelCase(str: string): string`

### 参数

**str** (`string`) *required*: 要转换的字符串。

### 返回值

**string**: 返回驼峰式格式的字符串。

## Changelog

See commit history for [src/transformers/string/camelCase.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/transformers/string/camelCase.ts).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
