I'm trying to do something fancy with a blogger blog, and when I'm looking at a particular blog, I'd like to be able to know which one it is.
So, although there might be a better way of doing it, I've got this bit of code set up:
//Get title of current blog
currentTitle = document.getElementById("post-title").innerText;
currentTitle = currentTitle.replace(/<\/?[^>]+(>|$)/g, "");
currentTitle = currentTitle.replace("/n","");
currentTitle = currentTitle.replace("/r","");
//Run through titles until you find a match
for (count = 0; count <= titles.length; count++)
{
//alert(currentTitle);
//alert(titles[count]);
if (titles[count] != null)
{
checkTitle = titles[count];
checkTitle = checkTitle.replace(/<\/?[^>]+(>|$)/g, "");
checkTitle = checkTitle.replace("/n","");
checkTitle = checkTitle.replace("/r","");
alert(checkTitle.toString()+" + "+currentTitle.toString());
if (checkTitle.toString() == currentTitle.toString())
{
alert(count);
}
}
}
Where titles[] is an array of titles read in from the RSS feed (the idea being that, if I get the index for the title, I can apply that to another array I've read from said feed).
Thing is, while the first alert produces two strings that appear identical, they aren't picked up by the if... statement. I've added lines to set the two variables to the same string, and that picks them up. The only solution I can even think of is that I'm missing a hidden character or something in one of the strings, but I think I have all of them covered! Anyone got any ideas?