我有这个字符串MIL_A_OP=LI_AND=SSB12=JL45==DO=90==IT=KR002112
,我需要根据第一个 "="将其拆分为 2
所以我需要它来获得:
第一个字符串:MIL_A_OP
第二个字符串:LI_AND=SSB12=JL45==DO=90==IT
下面的代码是我所拥有的,但它给了我 MIL_A_OP 和 LI_AND,我想念其余的
try
{
StreamReader file1 = new StreamReader(args[0]);
string line1;
while ((line1 = file1.ReadLine()) != null)
{
if (line1 != null && line1.Trim().Length > 0)//if line is not empty
{
int position_1 = line1.IndexOf('=');
string s_position_1 = line1.Substring(position_1, 1);
char[] c_position_1 = s_position_1.ToCharArray(0,1);
string[] line_split1 = line1.Split(c_position_1[0]);
Foo.f1.Add(line_split1[0], line_split1[1]);
}
}
file1.Close();
}
catch (Exception e)
{
Console.WriteLine("File " + args[0] + " could not be read");
Console.WriteLine(e.Message);
}