110,538
社区成员
发帖
与我相关
我的任务
分享
public void test()
{
string str = "[\"放上110kV母差保护110kV母分开关大电流试验端子流变\"侧短\"接螺丝,取下连接螺丝\"][2][21000000010014][6,5]";
// string RepStr = str.Replace("][", "|");
string[] WriteStr = str.Split(new string[] { "]","[" }, StringSplitOptions.RemoveEmptyEntries);
foreach (var arrString in WriteStr)
{
Response.Write(arrString + "<br />");
}
}
string text="[\"放上110kV母差保护110kV母分开关大电流试验端子流变\"侧短\"接螺丝,取下连接螺丝\"][2][21000000010014][6,5]";
string[] sary = text.Split(new string[] { "[", "]" }, StringSplitOptions.RemoveEmptyEntries);
StreamReader reader = new StreamReader("c:\\temp\\1.txt",Encoding.Default);
string source = reader.ReadToEnd();
Regex reg = new Regex(@"(?is)(?<=\[)[^]]+(?=\])");
MatchCollection mc = reg.Matches(source);
foreach (Match m in mc)
{
MessageBox.Show(m.Value);
}