Skip to content
0

katanakit-js / useCapitalize

Function: useCapitalize() ​

ts
function useCapitalize(text, locale?): string;

Defined in: src/core/services/formatter.service.ts:83

Pure: capitalizes the first character; leaves the rest unchanged.

Parameters ​

ParameterTypeDefault valueDescription
textstringundefinedThe string to capitalize.
locale"en" | "es" | "fr" | "de" | "it" | "pt" | "ja" | "zh""en"BCP 47 locale tag. Defaults to "en".

Returns ​

string

The string with its first character upper-cased.

Example ​

ts
import { useCapitalize } from "katanakit-js";

useCapitalize("hello world"); // "Hello world"

Released under the MIT License.