title: ASP.NET StreamWriter - new line after x commas
body: <p>I've got a JS array which is writing to a text file on the server using StreamWriter. This is the line that does it:</p>
  
  <pre><code>sw.WriteLine(Request.Form["seatsArray"]);
  </code></pre>
  
  <p>At the moment one line is being written out with the entire contents of the array on it. I want a new line to be written after every 5 commas. Example array:</p>
  
  <pre><code>BN,ST,A1,303,601,BN,ST,A2,303,621,BN,WC,A3,303,641,
  </code></pre>
  
  <p>Should output:</p>
  
  <pre><code>BN,ST,A1,303,601,
  BN,ST,A2,303,621,
  BN,WC,A3,303,641,
  </code></pre>
  
  <p>I know I could use a string replace but I only know how to make this output a new line after every comma, and not after a specified amount of commas.</p>
  
  <p>How can I get this to happen?</p>
  
  <p>Thanks!</p>