c# splitting a string and not returning empty string
<p>if i have a string:</p>

<pre><code>a = "1;2;3;"
</code></pre>

<p>and i would like to split it this way:</p>

<pre><code>foreach (string b in a.split(';')
</code></pre>

<p>how can i make sure that i return only <code>1,2,3</code> and not an empty string.</p>

<p>if i split <code>1;2;3</code> then i will get what i want, but if i split <code>1;2;3;</code> then i get an extra empty string</p>

<p>i have taken the suggestions and doing this:</p>

<pre><code>        string[] batchstring = batch_idTextBox.Text.Split(';', StringSplitOptions.RemoveEmptyEntries);
</code></pre>

<p>however i am getting these errors:</p>

<p>Error   1   The best overloaded method match for 'string.Split(params char[])' has some invalid arguments   C:\Documents and Settings\agordon\My Documents\Visual Studio 2008\Projects\lomdb\EnterData\DataEntry\DAL.cs 18  36  EnterData
Error   2   Argument '2': cannot convert from 'System.StringSplitOptions' to 'char' C:\Documents and Settings\agordon\My Documents\Visual Studio 2008\Projects\lomdb\EnterData\DataEntry\DAL.cs 18  68  EnterData</p>
