title: nodejs: string manipulation
body: <p>I have the following node.js code:</p>
  
  <pre><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&gt;f){
           var p=Math.floor(N/f);
           var p_rem=N%f;
  
           var hash="";
           for(var i=0;i&lt;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);
      });
  </code></pre>
  
  <p>But substr doesn't appear to work!</p>
  
  <p>How can I get substrings of a string in node.js?</p>
  
  <p>Many thanks in advance,</p>