how to split string according to character length
<p>I have a string which has say 3000 characters, now I want to split the same into array, where each index holding not more than 500 characters, I am not getting the logic for the same. I tried the below one but its not working..</p>

<p>say string arr holding 3000 characters... </p>

<p>I am using a loop to get the characters length of 500</p>

<p>here i am storing the value returned by the loop in an array...</p>

<p>say </p>

<pre><code>ArrayList ar = new ArrayList();

for(int i=0; i &lt; arr.Length; i+=500)
{
    ar.Add(arr.Substring(i,500));
}  

Response.Write(ar[0].ToString());
</code></pre>

<p>but this throws an error message saying </p>

<blockquote>
  <p>Index and length must refer to a location within the string.</p>
</blockquote>

<p>Please reply with the appropriate code for the same, any reply would be greatly appreciated.</p>
