Split Method vs Substring and IndexOf
<p>so I'm writing a program that parses a CSV. I'm using the split method to separate the values into a string array, but I've read in some articles that it's faster to use substring and indexOf. I wrote essentially what I would do with those two methods, and it seems like split would be better. Could someone explain how this is better, or if maybe I'm not correctly utilizing these methods?  Here's what I wrote: </p>

<pre><code>int indexOne = 0, indexTwo;
for (int i = 0; i &lt; 4; i++) //there's four diff values in one line
{
   if (line.indexOf(",", indexOne) != -1)
   {
       indexTwo = line.indexOf(",", indexOne);
       lineArr[i] = line.substring(indexOne, indexTwo);
       indexOne = indexTwo+1;
   }
}
</code></pre>