toTitleCase

import { toTitleCase } from "jsr:@ende/text/unstable-to-title-case";

function ยท experimental

function toTitleCase(input: string, options?: TitleCaseOptions): string

Converts a string into Title Case.

Note

This function preserves punctuation and does not insert spaces or other characters where none exist in the input (e.g. it doesn't split up camelCase words). This is in contrast to some other to{X}Case functions, such as toSnakeCase.

input: string

The string that is going to be converted into Title Case

options?: TitleCaseOptions

Optional settings to customize the conversion

Returns

The string as Title Case

Example: Usage

import { toTitleCase } from "@ende/text/unstable-to-title-case";
import { assertEquals } from "@ende/assert/equals";

assertEquals(toTitleCase("deno is awesome"), "Deno Is Awesome");

Source