开发者

Remove a word from a string

开发者 https://www.devze.com 2022-12-25 11:22 出处:网络
开发者_StackOverflowi want to remove a particular #keyword from a string. i dont know its position or anything.
开发者_StackOverflow

i want to remove a particular #keyword from a string. i dont know its position or anything. can i use javascript to do it?


var str = "particular #keyword";
str.replace("keyword", "new");
alert(str); //-> "particular #new"


yes, you can, using .replace() method

0

精彩评论

暂无评论...
验证码 换一张
取 消