How to convert “camelCase” to “Camel Case”?

后端 未结 11 942
北荒
北荒 2020-11-27 10:25

I’ve been trying to get a JavaScript regex command to turn something like \"thisString\" into \"This String\" but the closest I’ve gotten is replac

11条回答
  •  Happy的楠姐
    2020-11-27 11:00

    Not regex, but useful to know plain and old techniques like this:

    var origString = "thisString";
    var newString = origString.charAt(0).toUpperCase() + origString.substring(1);
    

提交回复
热议问题