i was manipulating the text in this document http://www.dlib.org/dlib/november14/brook/11brook.html, while i noticed something strange.
I was looking at the beginning of the article, in particular here:
Michelle Brook
The Content Mine
[email protected]
...
(I am using jquery xpath)
var string=$("document").xpath("form[1]/table[3]/tr/td/table[5]/tr/td/table[1]/tr/td[2]/p[2]").html();
var new_string=string.substring(0,14);
I would expect that new_string was "Michelle Brook", but it was "Michelle Bro".
Why that? Is there a particular char that makes string.substring() fail?
console.log()the string before you call.substring()and see what it really contains?for(var x=0;x<14;x++) console.log(string.CharAt(x));.charCodeAt().charCodeAt(1)is also another odd character (10,13,or 8206)