-1

*我有一个富文本框,在富文本框上我有下面的文本*

*结果:

  ALTER TABLE "TBL_A" ADD ("FIELD_A6" NUMBER(2,0) NOT NULL ENABLE)

  ALTER TABLE "TBL_A" DROP ("FIELD_A3")

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A2" VARCHAR2(20))

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2))

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NOT NULL ENABLE)

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A5" NULL)

有没有什么办法可以得到一个换行符的结果,每行也以分号结尾?:

预期结果:

  ALTER TABLE "TBL_A" ADD ("FIELD_A6" NUMBER(2,0) NOT NULL ENABLE);

  ALTER TABLE "TBL_A" DROP ("FIELD_A3");

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A2" VARCHAR2(20));

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2));

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NOT NULL ENABLE);

  ALTER TABLE "TBL_A" MODIFY ("FIELD_A5" NULL);
4

1 回答 1

1

这是方法:

string text = richTextBox1.Text;
richTextBox1.Text = "";

string[] splitted = text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

foreach (string line in splitted)
{
    richTextBox1.AppendText(Environment.NewLine + line.Trim() + ";" + Environment.NewLine);
}
于 2013-07-24T17:49:37.830 回答