To Camel Case

Converts a string to camel case.

CategoryStrings
AuthorPol Gubau
Since1.0.0
Last Updated2025-03-15
TypeSync
CompatibilityUniversal

Example

  • Input

    toCamelCase('hello-world')

    Output:

    'helloWorld'
  • Input

    toCamelCase('hello_world')

    Output:

    'helloWorld'

Return

Returns the camel-cased string.

Type: string

Props

NameTypeDefaultRequiredDescription
strstringnullYesThe string to convert to camel case.

Notes

This function converts strings with underscores or hyphens into camel case format.

Tags

  • string
  • camelCase
  • conversion

Related