richTextBoxResul・・・結果出力
textBoxCovert・・・付加文字
変換前データの各行ごとに付加文字をつけて結果出力したいです。
但し変換前データの空行の時は付加文字をつけたくないです。
空行でも関係なく付加することは出来たのですが
空行の時の処理がイマイチできません。
※ 関係なしに各行に追加版
// 初期化
this->richTextBoxResult->Text = "";
this->richTextBoxResult->Text = this->richTextBox->Text->Replace( "\n", this->textBoxCovert->Text +"\n" ) + this->textBoxCovert->Text;
※ 1行ずつ読み込んで空行か判定してから処理する版
// 初期化
this->richTextBoxResult->Text = "";
//TextBox1に入力されている文字列から一行ずつ読み込む
//文字列(TextBox1に入力された文字列)からStringReaderインスタンスを作成
System::IO::StringReader^ rs = gcnew System::IO::StringReader(this->richTextBox->Text);
//ストリームの末端まで繰り返す
while (rs->Peek() > -1){
//一行読み込んで表示する
if( rs->ReadLine() == "" || rs->ReadLine() == "\n" ) this->richTextBoxResult->Text += "\n";
else this->richTextBoxResult->Text += rs->ReadLine() + this->textBoxCovert->Text + "\n";
}
rs->Close();