API
@agape/string

toPascalCase Function

Converts a string to PascalCase.

API

function toPascalCase(  input: string): string

toPascalCase

string

Converts a string to PascalCase.

@paraminput:  string
A string to be returned in PascalCase.
@returnsstring

Description

Converts a string to PascalCase.

Removes non-alphanumeric characters, splits on casing and digits, capitalizes each word, and strips leading/trailing separators.

Usage

toPascalCase("hello world"); // "HelloWorld"
toPascalCase("first_name"); // "FirstName"
toPascalCase("user42Profile"); // "User42Profile"
toPascalCase("API response code"); // "ApiResponseCode"
toPascalCase("  messy__input--string  "); // "MessyInputString"