[英]javascript split / join character within quotes
I have some text and need to replace all instances of a character within quotes " z6 "
and replace with " / "
I'm not sure how to include quotes within quotes:我有一些文本,需要替换引号
" z6 "
中的所有字符实例并替换为" / "
我不确定如何在引号中包含引号:
text = text.split("" z6 "").join("" / "");
Escape using backslash使用反斜杠转义
text = text.split("\" z6 \"").join("\" / \"");
Or template strings:或模板字符串:
text = text.split(`" z6 "`).join(`" / "`);
Or single quotes或单引号
text = text.split('" z6 "').join('" / "');
You can use single quotes and double quotes interchangeably.您可以互换使用单引号和双引号。 To solve your specific problem:
要解决您的具体问题:
text = text.split('" z6 "').join('" / "');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.