---
title: "capitalize"
description: "Capitalize the first character of a string and lowercase the remaining characters, returning a tidy single-word display form."
canonical_url: "https://core.mhaibaraai.cn/en/docs/transformers/string/capitalize"
---
# capitalize

> Capitalize the first character of a string and lowercase the remaining characters, returning a tidy single-word display form.

## Usage

Converts the first letter of a string to uppercase and the remaining letters to lowercase.

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

capitalize('foo bar') // => 'Foo bar'
capitalize('FOO BAR') // => 'Foo bar'
```

## API

`capitalize(str: string): string`

### Parameters

**str** (`string`) *required*: The string to convert.

### Returns

**string**: Returns the string with the first letter capitalized.

## Changelog

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

---

- [GitHub](https://github.com/mhaibaraai/movk-core/blob/main/src/transformers/string/capitalize.ts)


## Sitemap

See the full [sitemap](https://core.mhaibaraai.cn/sitemap.md) for all pages.
