我想从TypeScript中的字符串中删除单引号 . 我用以下方法来实现这一点 .
var Id = this.currentId.replaceAll('"',''); var id = this.currentId.remove('\'', '');
尝试了上述方法 .
提前致谢
您可以使用String.prototype.replace查找并删除字符串中的所有单引号 .
例:
const stringWithoutSingleQuotes = stringWithSingleQuoutes.replace(/'/g, "")
1 回答
您可以使用String.prototype.replace查找并删除字符串中的所有单引号 .
例: