i want to split a string the following way:

```
string s = "012345678x0123x01234567890123456789";
s.SplitString("x",10);

```

should be split into

```
012345678
x0123
x012345678
9012345678
9

```

e.g. the inputstring should be split after the character "x" or length 10 - what comes first.

here is what i've tried so far:

```
public static IEnumerable<string> SplitString(this string sInput, string search, int maxlength)
{
    int index = Math.Min(sInput.IndexOf(search), maxlength);
    int start = 0;
    while (index != -1)
    {
        yield return sInput.Substring(start, index-start);
        start = index;
        index = Math.Min(sInput.IndexOf(search,start), maxlength);
    }
}

```