public static void Main()
Console.WriteLine(GetSubstring("One - Two",0));
Console.WriteLine(GetSubstring("One - Two",1));
Console.WriteLine(GetSubstring("One - Two",2));
public static string GetSubstring(string input, int index)
string returnValue = String.Empty;
string[] substrings = input.Split(new[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
returnValue = substrings.Length > index ? substrings[index] : returnValue;