Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
*如果字符串中存在字符,我想删除它。
*
这是我的代码,但它不起作用。
String.replace(/*/g '')
您必须*使用反斜杠转义特殊字符,因为它在正则表达式中具有另一种含义。
String.replace(/\*/g, '');
"Your string".replace("*", "");