首页 文章

如何从TypeScript中的字符串中删除单引号

提问于
浏览
0

我想从TypeScript中的字符串中删除单引号 . 我用以下方法来实现这一点 .

var Id = this.currentId.replaceAll('"','');
var id = this.currentId.remove('\'', '');

尝试了上述方法 .

提前致谢

1 回答

  • 0

    您可以使用String.prototype.replace查找并删除字符串中的所有单引号 .

    例:

    const stringWithoutSingleQuotes = stringWithSingleQuoutes.replace(/'/g, "")
    

相关问题