*强文本我有一个richTextBox,喜欢搜索以Hello Worlds 开头并包含“HERE”的句子行。并以 ; 结尾 半栏比我喜欢只删除“这里”。 . 我的句子,下面的例子只有一行句子,但句子可能有 2 行长,所以条件应该以 Hello Worlds 开头并以 ; 结尾 半列而不是删除“这里”。*
我的一句话:
Hello Worlds the weather is too hot "HERE"."IN" CANADA!;
我的两行句子可能是这样的:
Hello Worlds the weather is too hot "HERE"."IN" CANADA!. But we are still like it;
结果应该是一行:
Hello Worlds the weather is too hot "IN" CANADA!;
结果应为 2 行:
Hello Worlds the weather is too hot "IN" CANADA!. But we are still like it;
好吧,我坚持我的代码:
List<string> rt = new List<string>();
foreach (string line in richTextBox1.Lines)
{
if (line.StartsWith("Hello Worlds") && line.Contains("HERE"))
{
//remove "HERE".
}
}