javascript - Remove string after predefined string -


i pulling content rss feed, before using jquery format , edit rss feed (string) returned. using replace replace strings , characters so:

var spanish = $("#wod a").text(); var newspan = spanish.replace("=","-"); $("#wod a").text(newspan); 

this works great. trying remove text after point. similar truncation, hide text starting word "example".

in particular rss feed, word example in every feed. hide "example" , text follows word. how can accomplish this?

though there not enough jquery, don't need remove after word in given string. first approach use substring:

var new_str = str.substring(0, str.indexof("example")); 

the second trick split:

var new_str = str.split("example")[0]; 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -