110,538
社区成员
发帖
与我相关
我的任务
分享
if (s.Contains("["))
{
try
{
int wordEndIndex = s.IndexOf("[");
int proEndIndex = s.IndexOf(";");
int kindEndIndex = s.IndexOf(".");
string word = s.Substring(0, wordEndIndex+1);
string pro = s.Substring(wordEndIndex, proEndIndex+1 - wordEndIndex);
string kind = s.Substring(proEndIndex, kindEndIndex+1 - proEndIndex);
string meaning = s.Substring(kindEndIndex, s.Length - 1 - kindEndIndex);
Console.WriteLine(word + " " + pro + " " + kind + " " + meaning);
}
catch (System.Exception ex)
{
sw.WriteLine("第"+i+"行出现问题:"+ex.ToString());
}
}