替换代码
str.replace(/"/g, "'")
将双引号替换为单引号,如果字符串中,存在space(空格)时,使用以上语句将会导致空格被替换为双引号,可以使用如下代码处理
str.replace(/s+/g, ' ').replace(/"/g, "'")