私のコードは各行の最後にセミコロンを追加しています...しかし、richtextbox1の2番目の文で ) 括弧を閉じる必要があります。どうすれば正しく追加できますか?
NOT: 私の 2 番目の文は任意の単語で終わることができます。つまり、連続した s.Endwith("no") replace ("no",");")..... 使用するオプションではありません!.
私のコードは置くだけです; 各行の終わり
string[] lines = richTextBox1.Lines;
List<string> ToAdd = new List<string>();
string filter = ")";
foreach (string s in lines)
{
string hold = s;
if (s.EndsWith(")"))
hold = s.Replace(filter, ";");
}
richTextBox1.Lines = ToAdd.ToArray();
私の結果
This is my sentence (Yes);
This is my sentence (Yes) or no;
This is my sentence (Yes);
This is my sentence (Yes);
この結果が欲しい:
This is my sentence (Yes);
This is my sentence (Yes) or no);
This is my sentence (Yes);
This is my sentence (Yes);