pascalCase

Convert a string to PascalCase, capitalizing each word and removing separators, ideal for type, class, and component names.

Usage

Converts a string to PascalCase format (each word capitalized with no separators).

import { pascalCase } from '@movk/core'

pascalCase('firstName') // => 'FirstName'
pascalCase('first_name') // => 'FirstName'
pascalCase('first-name') // => 'FirstName'
pascalCase('XMLHttpRequest')// => 'XmlHttpRequest'

API

pascalCase(str: string): string

Parameters

str
string required
The string to convert.

Returns

string
Returns the string in PascalCase format.

Changelog

No recent changes
Copyright © 2024 - 2026 YiXuan - MIT License