I have below string
string arguments = "-p=C:\Users\mplususer\Documents\SharpDevelop Projects\o9\o9\bin\Debug\o9.exe""-t=False""-r=TestRun";
I want to split string with "-t=" and get false value
if (arguments.Contains("-t="))
{
string[] value = arguments.Split(new string[] { "\"-t=" }, StringSplitOptions.None);
if (value.Length != 0)
{
mode = value[1].Replace("\"", "");
}
}
String.Splitnever returns an emptystring[]. If the delimiter is not contained you get an array with one string which is the complete source string. So yourvalue.Length != 0-check is incorrect. It's redundant anyway because you have used alreadyif (arguments.Contains("-t=")).