Convert camelCaseText to Sentence Case Text

后端 未结 20 2162
闹比i
闹比i 2020-11-28 03:44

How can I convert a string either like \'helloThere\' or \'HelloThere\' to \'Hello There\' in JavaScript?

20条回答
  •  时光取名叫无心
    2020-11-28 04:23

    I think this can be done just with the reg exp /([a-z]|[A-Z]+)([A-Z])/g and replacement "$1 $2".

    ILoveTheUSADope -> I Love The USA Dope

提交回复
热议问题