我怎样才能转换这段文字?

时间:2018-04-08 02:35:08

标签: javascript node.js

如何转换此文字?

由此:

Also known as "test".

对此:

Also known as "test"

2 个答案:

答案 0 :(得分:1)

使用NodeJS,您可以使用名为entities的热门程序包:

const entities = require("entities");
entities.decodeHTML("Also known as "test"");
// outputs: Also known as "test"

答案 1 :(得分:0)

您可以使用替换功能

'Also known as "test"'.replace(/"/g,'');

g标志与正则表达式一起使用以替换所有实例。