Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.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#_Richtextbox_Windows Applications - Fatal编程技术网

C# 对richtextbox中的数据进行操作

C# 对richtextbox中的数据进行操作,c#,richtextbox,windows-applications,C#,Richtextbox,Windows Applications,我试图从richtextbox中获取的字符串中提取某一行。这是我收到的richbox文本 AZD0495911180U1200811040957 374058860984303 8L589M 08081990 我想移到第三行,对其字符进行计数,如果计数为6,那么我想移到前一行并提取它。结果应该是我只得到374058860984303。当我以字符串形式获取richboxtext并进行调试时,我会得到以下结果: AZD0495911180U1200811040957\n37405886098430

我试图从richtextbox中获取的字符串中提取某一行。这是我收到的richbox文本

AZD0495911180U1200811040957
374058860984303
8L589M
08081990
我想移到第三行,对其字符进行计数,如果计数为6,那么我想移到前一行并提取它。结果应该是我只得到374058860984303。当我以字符串形式获取richboxtext并进行调试时,我会得到以下结果:

AZD0495911180U1200811040957\n374058860984303\n8L589M\n
请帮助我如何实现以下目标:
我已经搜索过Environment.Newline函数,但我不知道如何在这个上下文中使用它来在行之间移动并提取所需的数据

你可以这样做

  var str = "AZD0495911180U1200811040957\n374058860984303\n8L589M\n";
  var strArr = str.Split(Environment.NewLine.ToCharArray());
现在在数组“strArr”中搜索字符串,并获取数组成员