jQuery Title Case

后端 未结 13 2182
小鲜肉
小鲜肉 2020-12-12 22:54

Is there a built in way with jQuery to \"title case\" a string? So given something like bob smith, it turns into \"Bob Smith\"?

13条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 23:16

        function camelCase(str){
            str     = $.camelCase(str.replace(/[_ ]/g, '-')).replace(/-/g, '');
            return  str;//.substring(0,1).toUpperCase()+str.substring(1);
        },
    

提交回复
热议问题