How can i split the string only once using C#

c#

Solution

Specify the maximum number of items that you want:

string[] splitted = text.Split(new string[]{" - "}, 2, StringSplitOptions.None);

Problem

Example : a - b - c must be split as a and b - c, instead of 3 substrings

Original source