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.
我有一个如下值:如果它存在于值中,...India我想删除它。...
...India
...
如何使用 underscore.js 或 jquery 或 javascript 做到这一点?
谢谢
您可以使用基本的 JavaScript替换方法来做到这一点
var myString = myString.replace('...','');
如果您需要更复杂的替换,那么您可能需要考虑使用RegEx 模式。
尝试正则表达式:
"...India".replace(/\./g, '');
利用replace()
replace()
var data="...India"; alert(data.replace('...',''));
但是,这会替换所有出现的搜索字符串...如果您只有..India.
..India