I want to check if there is any error under "LIST OF RECEIVED ERRONEOUS FILES " .If there is any error then
i have to copy the data from “CP/FIRM” column and store and display it, if number is not there then skip
in the sample file attached under “LIST OF RECEIVED ERRONEOUS FILES” there are BP 777 ,BP 877,SP 556,SP87 we need these numbers from text file . and these numbers are dynamic
Split Based on the Text " LIST OF RECEIVED ERRONEOUS FILES "
Consider 2nd Part of it…and Split again based on text " CCD CP/FIRM FILE NON-NO DATE TIME NUM ERROR FILE MESSAGE"
Now u will get the targeted text
Split Based on “New Line”(Environment.NewLine)
Checke each line wthether it is starting with String or Int …
if string "Split again based on “Space” and consider 2nd , 3rd strings
if int Consider directly and add the privious BP or SP
@sankar.kuna - your point 4 is incorrect, see lines 59 & 64 in the sample file. They start with numbers, but the values needed are not present.
Also in most cases checking for “Is it a String” is like not checking at all - from text file perspective, everything is a string (even an empty line = String.Empty = String).
Your solution also creates a lot of additional memory allocations (every split produces a new array of strings). For big files that can be an issue. It’s usually better to read once and iterate forward (let’s leave streamreaders aside in Rookies section) - string operations on todays CPU’s are for the most part fast enough that extra calculations take less time than allocations (and you don’t risk OOM).