I have the following node.js code:
conn.on("data",function(x){
var responseData=x;
//sys.puts(responseData);
sys.puts(responseData.length);
var f=50;
var N=responseData.length;
if(N>f){
var p=Math.floor(N/f);
var p_rem=N%f;
var hash="";
for(var i=0;i<p;i++){
hash=DJBHash(responseData.substr(f*i,f)); //this line causes program to exit!
sys.puts(responseData.substr(f*i,f)+"***"+hash);
}
}
soc.write(x);
});
But substr doesn't appear to work!
How can I get substrings of a string in node.js?
Many thanks in advance,