Question: I'm splitting a string with "\0" separators and I'm getting an extra blank trailing item and I'm not sure why. There should be 5 parameters, each terminated by a "\0". Here is the string:

> 
> Splash\0\0Message here.\01Back\0\0
> 
> 
> 

here is my code:

```
var paramList = new List<string>(parameters.Split("\0".ToCharArray()));

```

here is why I'm getting:

```
[0] = "Splash"
[1] = ""
[2] = "Message here."
[3] = "1Back"
[4] = ""
[5] = ""

```

I can't remove the empty parameters when splitting since their position is important.

The string has 5 parameters/separators, but is returning 6 elements. Position is important because [0] is always the title, [1] the subtitle, [2] the message, [3] button 1, [4] button 2.

It's easy enough for me to just ignore the final item, but I'd like to know why it's there and what I'm doing wrong.

Answer: 
You aren't doing anything wrong. There is not an extra result. It is working exactly as it should.

Split isn't for finding substrings that are terminated by the given separators, instead it splits substrings at the given separator.

Like cutting a loaf of bread, if you make 1 cut, you end up with 2 pieces.
If you make two cuts, you end up with 3 pieces.
If you make 3 cuts, you end up with 4 pieces.
and so on...

You have 5 cuts (5 "\0" separators), so you'll end up with 6 substrings.

If you don't want the last one, then just remove it. There are plenty of ways to do that! Search for "remove last element from List", "remove last element from array", or whichever your preferred container type is.
If you only want the first five, use `Take(5)`?...

```
        string parameters = @"Splash\0\0Message here.\01Back\0\0";
        var paramList = new List<string>(parameters.Split(new string[] { @"\0" }, StringSplitOptions.None).Take(5));
        for(int i = 0; i < paramList.Count; i++)
        {
            Console.WriteLine(i.ToString() + ": " + paramList[i]);
        }

```