【发布时间】:2014-03-23 05:36:33
【问题描述】:
我喜欢删除以 ; 结尾的富文本框的最后一行半栏。我喜欢删除这一行,直到;最后一个半列之前的半列。
示例:
hello do not delete this line;
hello this sentence will continue...
untill here;
结果应该是:
hello do not delete this line;
我的代码:
private void button1_Click_1(object sender, EventArgs e) {
List<string> myList = richTextBox1.Lines.ToList();
if (myList.Count > 0) {
myList.RemoveAt(myList.Count - 1);
richTextBox1.Lines = myList.ToArray();
richTextBox1.Refresh();
}
}
【问题讨论】:
标签: c# regex substring stringbuilder