capitalize
Capitalize the first letter of a string.
Installation
npx react-usekit@latest init
Select: utils → TypeScript or JavaScript → path -> capitalize
Usage
import { capitalize } from "./utils/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 |