Skip to content

CaseConversion

capitalizeInitial

Capitalizes the first letter of a word in a string.

capitalizeInitial('hello') // 'Hello'
capitalizeInitial(':> hello') // ':> Hello'

capitalizeWords

Capitalizes the first letter of each word in a given string.

capitalizeWords('hello world') // 'Hello World'
capitalizeWords('This was your big idea, remember?') // 'This Was Your Big Idea, Remember?'

snakeCase

Converts a string to snake_case format.

snakeCase('hello WorLd') // 'hello_world'
snakeCase('from-kebab-case') // 'from_kebab_case'
snakeCase('snake Case With Numbers123', true) // 'snake_case_with_numbers_one_two_three'

kebabCase

Converts a string to kebab-case format.

kebabCase('h3llo WoRld') // 'h3llo-world'
kebabCase('from_snake_case') // 'from-snake-case'
kebabCase('kebab Case With Numbers123', true) // 'kebab-case-with-numbers-one-two-three'

camelCase

Converts a string to camelCase format.

camelCase('hello WoRld') // 'helloWorld'
camelCase('Test CaSe ExamplE') // 'testCaseExample'
camelCase('camel Case With Numbers123') // 'camelCaseWithNumbers'

pascalCase

Converts a string to PascalCase format.

pascalCase('hello WoRld') // 'HelloWorld'
pascalCase('Test CaSe ExamplE') // 'TestCaseExample'
pascalCase('pasCal Case With Numbers123') // 'PascalCaseWithNumbers'