winform文本内容多段拼接
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
List<string> midList = new List<string>();
foreach (string item in richTextBox1.Lines)
{
if (!midList.Contains(item)) { midList.Add(item); }
}
if (midList[midList.Count - 1] == "")
{
midList.RemoveAt(midList.Count - 1);
}
foreach (string items in midList)
{
//i = 0;
string input_links = Regex.Replace(items, " ", "','");
richTextBox2.Text += "('" + input_links + "')" + "\r\n";
//i++;
//if(i > 200) { i = 0; Application.DoEvents(); }
Application.DoEvents();
}
}
}
}

浙公网安备 33010602011771号