capitalize
Capitalize the first letter of a string.
Installation
pnpm dlx shadcn@latest add @reactusekit/capitalizeUsage
import { capitalize } from "@/lib/capitalize"
function App() {
const text = "hello world"
const capitalizedText = capitalize(text)
return (
<div>
<p>Original: {text}</p>
<p>Capitalized: {capitalizedText}</p>
</div>
)
}API
Parameters
| Parameter | Type | Description |
|---|---|---|
str | string | The string to capitalize |
Returns
| Type | Description |
|---|---|
string | The string with the first letter capitalized |