Capitalize
VerifiedUppercases the first character of a string.
- string
- capitalize
Install
npx shadcn@latest add https://quicksnip.dev/r/capitalize.jsonCode
/** Uppercases the first character of a string and leaves the rest untouched. */
export function capitalize(input: string): string {
return input.charAt(0).toUpperCase() + input.slice(1);
}Usage
capitalize("hello world"); // "Hello world"