title: fast custom string splitting
body: <p>I am writing a custom string split. It will split on a dot(<code>.</code>) that is not preceded by an odd number of backslashes (<code>\</code>).</p>
  
  <pre><code>«string» -&gt; «IEnemerable&lt;string&gt;»
  "hello.world" -&gt; "hello", "world"
  "abc\.123" -&gt; "abc\.123"
  "aoeui\\.dhtns" -&gt; "aoeui\\","dhtns"
  </code></pre>
  
  <p>I would like to know if there is a substring that will reuse the original string (for speed), or is there an existing split that can do this fast?</p>
  
  <hr>
  
  <p>This is what I have but is 2—3 times slower than <code>input.Split('.')</code> //where input is a string. (I know it is a (slightly more complex problem, but not that much)</p>
  
  <pre><code>    public IEnumerable&lt;string&gt; HandMadeSplit(string input)
      {
          var Result = new LinkedList&lt;string&gt;();
          var word = new StringBuilder();
          foreach (var ch in input)
          {
              if (ch == '.')
              {
                  Result.AddLast(word.ToString());
                  word.Length = 0;
              }
              else
              {
                  word.Append(ch);
              }
          }
          Result.AddLast(word.ToString());
          return Result;
      }
  </code></pre>
  
  <hr>
  
  <p>It now uses List instead of LinkedList, and record beginning and end of substring and use string.substring to create the new substrings. This does a lot and is nearly as fast as string.split but I have added my adjustments. (will add code)</p>