Skip to content

Conversation

@Wing-9527
Copy link
Contributor

Description

add capitalize method
example: input hello output Hello

src/string.ts Outdated
* ```
*/
export function capitalize(str: string): string {
return str[0].toUpperCase() + str.substring(1).toLowerCase()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return str[0].toUpperCase() + str.substring(1).toLowerCase()
return str[0].toUpperCase() + str.slice(1).toLowerCase()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok👍

@antfu antfu merged commit d8baab2 into antfu:main Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants