请问这个字符串如何转数组?'["1","2","3"]'
发布于 2个月前 作者 youqingkui 235 次浏览 来自 问答
> a = '["1","2","3"]'
'["1","2","3"]'
> a.split()
[ '["1","2","3"]' ]
> a.split(",")
[ '["1"', '"2"', '"3"]' ]
> a.split(",")
[ '["1"', '"2"', '"3"]' ]

想把它转换为["1", "2", “3”], 是先要去掉字符串的’[ 吗?谢谢!

2 回复

JSON.parse(a) 发自 CNodeJs ionic

@ilanceli 感谢,真是没有想到啊!

回到顶部