---
title: "upperFirst"
description: "Uppercase only the first character of a string while preserving the rest, a small helper for sentence and label formatting."
canonical_url: "https://core.mhaibaraai.cn/en/docs/transformers/string/upper-first"
---
# upperFirst

> Uppercase only the first character of a string while preserving the rest, a small helper for sentence and label formatting.

## Usage

Uppercases only the first letter of a string, leaving the rest unchanged.

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

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

## API

`upperFirst(str: string): string`

### Parameters

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

### Returns

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

## Changelog

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

---

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


## Sitemap

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