Alternatively js Chinese string [] symbol and other special Chinese method replace ()

Alternatively Chinese js string [] a method other special Chinese symbol


Recently I came across a js replaced (removed) in a string of Chinese characters, and special Chinese characters "[" and "]" and
under collecting did not find a viable solution: After groping found the following method is effective
as

var foo = '【你好】,【世界】';
//想要替换foo中的【】为指定字符串或者空,可以使用unicode的方法
 foo= foo.replace(/\u3010/g,"");//  \u3010  指的是【的unicode编码
 foo= foo.replace(/\u3011/g,"");//  \u3011  指的是】的unicode编码

About coding unicode conversion of more than [] and other special symbols can
go unicode encoding conversion http://tool.chinaz.com/tools/unicode.aspx page get converted

The results of the above code is run
你好,世界

Published 37 original articles · won praise 29 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_42755868/article/details/84958678