Convert string to Pascal Case (aka UpperCamelCase) in Javascript

前端 未结 3 1170
清歌不尽
清歌不尽 2020-12-10 01:13

Id like to know how I can covert a string into a pascal case string in javascript (& most probally regex).

Conversion Examples:

  • double-barrel = Dou
3条回答
  •  时光说笑
    2020-12-10 01:24

    In case dash, space and other are string separators one may use lodash.

    e.g.

    _.upperFirst(_.camelCase('double-barrel')); // => DoubleBarrel
    

提交回复
热议问题