toSentenceCase

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

function ยท experimental

function toSentenceCase(input: string, options?: SentenceCaseOptions): string

Converts a string into Sentence 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 Sentence Case

options?: SentenceCaseOptions

Optional settings to customize the conversion

Returns

The string as Sentence Case

Example: Usage

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

assertEquals(toSentenceCase("deno is awesome"), "Deno is awesome");

Source