javascript 你如何删除javascript中的unicode字符?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10430562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 09:52:04 来源:igfitidea点击:
How do you remove unicode characters in javascript?
提问by manraj82
Im trying to remove some unicode characters[E000-F8FF] from a string.How do I go about doing this in javascript? For example I looking to strip E018 from this string :
我试图从字符串中删除一些 unicode 字符 [E000-F8FF]。我该如何在 javascript 中执行此操作?例如,我希望从此字符串中去除 E018 :
The IT Crowd
IT 人群
回答by Fabrizio Calderan
str = str.replace(/[\uE000-\uF8FF]/g, '');
Screenshot taken from firebug:
萤火虫截图: