title: What are the alternatives to Split a string in c# that don't use String.Split()
body: <p>I saw this <a href="https://stackoverflow.com/q/3585344/119477">question</a> that asks given a string "smith;rodgers;McCalne" how can you produce a collection. The answer to this was to use String.Split. </p>
  
  <p>If we don't have Split() built in what do you do instead? </p>
  
  <p><strong>Update:</strong></p>
  
  <p>I admit writing a split function is fairly easy. Below is what I would've wrote. Loop through the string using IndexOf and extract using Substring.</p>
  
  <pre><code>string s = "smith;rodgers;McCalne";
  
  string seperator = ";";
  int currentPosition = 0;
  int lastPosition = 0;
  
  List&lt;string&gt; values = new List&lt;string&gt;();
  
  do
  {
      currentPosition = s.IndexOf(seperator, currentPosition + 1);
      if (currentPosition == -1)
          currentPosition = s.Length;
  
      values.Add(s.Substring(lastPosition, currentPosition - lastPosition));
  
      lastPosition = currentPosition+1;
  
  } while (currentPosition &lt; s.Length);
  </code></pre>
  
  <p>I took a peek at SSCLI implementation and its similar to the above except it handles way more use cases and it uses an unsafe method to determine the indexes of the separators before doing the substring extraction. </p>
  
  <p>Others have suggested the following.</p>
  
  <ol>
  <li>An Extension Method that uses an Iterator Block </li>
  <li>Regex suggestion (no implementation)</li>
  <li>Linq Aggregate method</li>
  </ol>
  
  <p>Is this it?</p>