Reputation: 27
Am trying to extract a certain line from the String that am getting from the richtextbox. Here is my richbox text that am getting.
AZD0495911180U1200811040957
374058860984303
8L589M
08081990
I want to move to the third line count its characters and then if the count is 6 then i want to move to the previous line and extract it. the result should be me getting 374058860984303 only. When i get the richboxtext in a string and debug i get the following:
AZD0495911180U1200811040957\n374058860984303\n8L589M\n
Please help me how can i acheive this: I have searched about Environment.Newline function but i ain't able to figure out how to use it in this context to move between lines and get the desired data extracted!
Upvotes: 0
Views: 67
Reputation: 1880
You can do it like this....
var str = "AZD0495911180U1200811040957\n374058860984303\n8L589M\n";
var strArr = str.Split(Environment.NewLine.ToCharArray());
Now search for your string in the array "strArr" and take the array memeber whatever you want
Upvotes: 1