i'm trying to trim down a string before removing parts of it, but there's something off about the spaces in the string.
the string i'm trying to trim is this
200 KristianMedK fisk {dropdownbegin} Ikke valgt fisk fugl dinosaur kristian {dropdownend} Ikke valgt {dropdownbegin} Ikke valgt KristianMedK Laks TunMedT lasse {dropdownend}
the string is being returned from the .text() method of an element in the tablesorter jquery library. I've already filtered out a bunch of ↵ characters from the string by
mystring = mystring.replace(/\n/g, "")
using
mystring= mystring.replace(" ","")
made no difference either.
How can i find out where if any otoher special characters is hiding in the string messing with the javascript?
my end goal is removing the content between the {dropdownbegin} and {dropdownend} but the substring i get when getting indexof is wrong and includes some of the text after the {dropdownend}
var index1 = text.indexOf("{dropdownbegin}");
var index2 = text.indexOf("{dropdownend}");
var substr = text.substr(index1, index2);
text = text.replace(substr, "");
the above code gives the substring
{dropdownbegin} Ikke valgt fisk fugl dinosaur kristian {dropdownend} Ikke valg
for reasons i do not know.
EDIT the trim issue was solved quickly as i failed to search properly for existing questions.