Skip to content

capitalize

ts
function String.capitalize<T extends string>(
    target: T,
): Capitalize<T>

Capitalizes the first letter of target string.

Example

ts
import { String } from "@monstermann/string";

String.capitalize("hello world"); // "Hello world"
String.capitalize("hello"); // "Hello"
ts
import { String } from "@monstermann/string";

pipe("hello world", String.capitalize()); // "Hello world"
pipe("hello", String.capitalize()); // "Hello"