Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Regex-通过`dot将字符串转换为驼峰形大写`_Javascript_Regex - Fatal编程技术网

Javascript Regex-通过`dot将字符串转换为驼峰形大写`

Javascript Regex-通过`dot将字符串转换为驼峰形大写`,javascript,regex,Javascript,Regex,我正在寻找一种解决方案,通过它包含的dot将我的字符串转换为camelcaps 这是我的字符串:'sender.state' 我希望结果是:'senderState' 我试过这样做:'sender.state'.replace(/\./g',)它删除了,但是如何处理驼峰帽内容?您可以将函数传递给。replace(): 您可以将函数传递给.replace(): 没有regex-这可能会有帮助: var str = "bad.unicron"; var temp = str.split(".");

我正在寻找一种解决方案,通过它包含的
dot
将我的字符串转换为
camelcaps

这是我的字符串:
'sender.state'

我希望结果是:
'senderState'


我试过这样做:
'sender.state'.replace(/\./g',)
它删除了
,但是如何处理
驼峰帽
内容?

您可以将函数传递给
。replace()


您可以将函数传递给
.replace()


没有
regex
-这可能会有帮助:

var str = "bad.unicron";
var temp = str.split(".");
return temp[0]+temp[1].charAt(0).toUpperCase() + temp[1].slice(1);

我将尝试使用
regex
而不使用
regex
-这可能会有帮助:

var str = "bad.unicron";
var temp = str.split(".");
return temp[0]+temp[1].charAt(0).toUpperCase() + temp[1].slice(1);

我将尝试想出
regex

这很好:)这很好:)