"{"A":"5","B":"4","C":"3","D":"2"}"分别取出ABCD

求帮助

分别取出四个值


繁星点点滴滴
浏览 510回答 1
1回答

守候你守候我

replace + split'{"A":"5","B":"4","C":"3","D":"2"}'.replace(/(?:"[^"]+":)|["{}]/g,'').split(',') ["5", "4", "3", "2"]splitstr = '{"A":"5","B":"4","C":"3","D":"2"}';str.split(/(?:^\{|",)"[^"]+":"|"\}$/g).slice(1,-1) ["5", "4", "3", "2"]简化~str.split(/[{"][^:]+:"|"\}/g).slice(1,-1) ["5", "4", "3", "2"]
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript