es-toolkit/docs/reference/string/upperFirst.md
mattiacoll 16fda3f24c
feat(upperFirst): Add upperFirst function (#404)
* feat(upperFirst): Add upperFirst function

* Add upperFirst benchmark

* Add upperFirst english docs

* Update docs/reference/string/upperFirst.md

---------

Co-authored-by: Sojin Park <raon0211@gmail.com>
Co-authored-by: Sojin Park <raon0211@toss.im>
2024-08-25 22:15:19 +09:00

452 B

upperFirst

Converts the first character of string to upper case.

Signature

function upperFirst(str: string): string;

Parameters

  • str (string): The string that is to be changed.

Returns

(string) The string converted.

Examples

import { upperFirst } from 'es-toolkit/string';

upperFirst('fred') // returns 'Fred'
upperFirst('Fred') // returns 'Fred'
upperFirst('FRED') // returns 'FRED'