- string fg = TextBox1.Text.Trim(); //分隔符
- string content = TextBox2.Text.Trim(); //要处理的代码内容
- //
- MatchCollection mc = Regex.Matches(content, System.Environment.NewLine);
- int start = 0;
- string line;
- foreach (Match ma in mc)
- {
- line = content.Substring(start, ma.Index - start);
- start = ma.Index + 1;
- try
- {
- line = line.Trim().Remove(0, line.IndexOf(fg) + 1);
- }
- catch (ArgumentOutOfRangeException ao)
- {
- continue;
- }
- Response.Write(line);
- Response.Write("<br/>");
- }
高亮代码复制处理问题
最新推荐文章于 2024-10-27 12:03:25 发布