C# File Handling to get repeated Text -


my document file consist following data

author : xxxx detail : abc#$  author : yyyy detail : abc#$  author : xxxx detail : def#$   author : yyyyy detail : abc#$  author : zzzzz detail : abc#$ 

and "#$" denotes end of detail .

   public  list< string>  gett(string author)     {          filestream fs = new filestream("detail.doc",filemode.open);          streamreader fr = new streamreader(fs);         string data = fr.readtoend();          list<string> ff = new list<string>();           int length = data.length;          (int k = 0; k < length; k++)         {              int = (data.indexof(author, 0));              int j = (data.indexof(author + "#$", 0));              int len = j - i;               k = j;                 ff.add(data.substring(i, len));        }          return ff;      } 

and have written above code fetch detail . went wrong ...

and aim , example : if give "xxxx" author name should show "detail" given author

output

 detail:abc   detail:def 

can 1 me?


Comments