---
title: "pascalCase"
description: "将字符串转换为帕斯卡式 (HelloWorld)。"
seo_title: "pascalCase"
seo_description: "Convert a string to PascalCase, capitalizing each word and removing separators, ideal for type, class, and component names."
canonical_url: "https://core.mhaibaraai.cn/docs/transformers/string/pascal-case"
---
# pascalCase

> 将字符串转换为帕斯卡式 (HelloWorld)。

## 用法

将字符串转换为帕斯卡命名格式（PascalCase，每个单词首字母大写）。

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

pascalCase('firstName') // => 'FirstName'
pascalCase('first_name') // => 'FirstName'
pascalCase('first-name') // => 'FirstName'
pascalCase('XMLHttpRequest')// => 'XmlHttpRequest'
```

## API

`pascalCase(str: string): string`

### 参数

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

### 返回值

**string**: 返回帕斯卡式格式的字符串。

## Changelog

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


## Sitemap

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