2017-08-15 93 views

回答

0

截至更換所有問題的字符。

String.prototype.replaceAll = function(str1, str2, ignore) 
{ 
    return this.replace(new RegExp(str1.replace(/([\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g, function(c){return "\\" + c;}), "g"+(ignore?"i":"")), str2); 
}; 

然後對於每個文本單元格:

function cleanHTML(input) { 
    var output = input.replaceAll('「','"'); 
    output = output.replaceAll('」', '"'); 
    output = output.replaceAll("’", "'"); 
    output = output.replaceAll("‘", "'"); 
    output = output.replaceAll("", "'"); 
    output = output.replaceAll("", "-"); 
    output = output.replaceAll("", "'"); 
    return output; 
} 

無論其他章程將在稍後顯示,我將爲其添加一個替換。 希望有人會從中受益。