I want to read some specific information from a .txt file and display that particular lines inside a TextBox in a c# form application. The .txt file template looks like this:
info1: some characters here…
info2: some characters here…
info3: some characters
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9
<h1> ---------------------------------------------------------------
001 a b c d e f g h
001 c a f d f b e t
001 a b c d e f g h
002 c a f b f b e t
002 z e f d f b e m
002 c a j u t b h t
002 y l f d f b n t
006 c a j y t b d t
007 b a f d r b t t
007 c a f r f b e q
007 c a f d f x z t
007 c p f d s b a t
007 c a f h f b e p
<h1>----------------------------------------------------------------
Additional info: numbers of lines similar to info3 is not fixed;
The functionality I need is to insert in a TextBox a the group of numbers which will correspond to the first columns (eg. 001) , And then display in another text box the header information of the file, the columns titles, and after that, Only the lines which starts with the number introduced excluding the others. How should a good solution for that would be?
Thanks.
In this case you should use String.StartsWith
Example: