es-toolkit/docs/reference/string/upperFirst.md

28 lines
456 B
Markdown
Raw Normal View History

# upperFirst
Converts the first character of string to upper case.
## Signature
```typescript
function upperFirst(str: string): string;
```
### Parameters
- `str` (`string`): The string that is to be changed.
### Returns
(`string`) The string converted.
## Examples
```typescript
import { upperFirst } from 'es-toolkit/string';
2024-08-31 08:45:20 +03:00
upperFirst('fred'); // returns 'Fred'
upperFirst('Fred'); // returns 'Fred'
upperFirst('FRED'); // returns 'FRED'
```