Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否从RichtextBox中删除行?_C#_.net_Regex_Richtextbox - Fatal编程技术网

C# 是否从RichtextBox中删除行?

C# 是否从RichtextBox中删除行?,c#,.net,regex,richtextbox,C#,.net,Regex,Richtextbox,我有一个richTextBox,有50多行。。。我想删除已移动存储的行。。例如,下面的第一行单词(在richtextbox中实际上有两行)具有结尾的半列具有移动存储单词,而不是删除所有2行 ALTER TABLE "CAMPUS_SITE" MOVE STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_P

我有一个richTextBox,有50多行。。。我想删除已移动存储的行。。例如,下面的第一行单词(在richtextbox中实际上有两行)具有结尾的半列具有移动存储单词,而不是删除所有2行

ALTER TABLE "CAMPUS_SITE" MOVE STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT);

DROP INDEX XIE2TBL_A;
DROP INDEX XPKTBL_A;
预期结果:

DROP INDEX XIE2TBL_A;
DROP INDEX XPKTBL_A;

从你的问题来看,似乎你想删除包含“移动存储”的行。你应该试试这个

var text = "";//Holds the text of current line being looped.
        var startindex = 0;//The position where selection starts.
        var endindex = 0;//The length of selection.

        for (int i = 0; i < richTextBox1.Lines.Length; i++)//Loops through each line of text in RichTextBox
        {
            text = richTextBox1.Lines[i];//Stores current line of text.
            if (text.Contains("MOVE STORAGE") == true)//Checks if the line contains MOVE STORAGE.
            {
                startindex = richTextBox1.GetFirstCharIndexFromLine(i);//If match is found the index of first char of that line is stored in startindex.
                endindex = text.Length;//Gets the length of line till semicolon and stores it in endindex.
                richTextBox1.Select(startindex, endindex);//Selects the text.
                richTextBox2.Text = richTextBox1.Text.Replace(richTextBox1.SelectedText, string.Empty);//Replaces the text with empty string.
            }
        }
var text=”“//保存正在循环的当前行的文本。
var startindex=0//选择开始的位置。
var-endindex=0//选择的长度。
for(int i=0;i
您希望它是正则表达式吗?实际上您有4行,空行也在那里您想删除它还是?