I have Data in Notepad that looks like this
and im writing it to an output file
01 some Data
02 some Data
02 some data
03 some data(End of client 1)
01 some data
02 some data
02 some data
02 some data
03 some data(End of client 2)
I wana count howmany times the value 02 appears and display it after The end of each client
Im using this piece of code to count (
int count = File.ReadLines(@"C:\Exercises\gamenam.dat").Count(line => line.StartsWith("02"));)
I want to know how do you display it after the end of each client?
Can you maybe guide me how to this?
Loading
James37 reputationPosted Feb 18, 2014, 10:10 AM EST
http://www.tamarsolutions.co.uk/csharp-intermediate/get-count-of-specific-character-in-string-csharp-method-extension/
VulpesRank #55 · 29.2K reputationPosted Feb 18, 2014, 11:11 AM EST
If so, try this code:
After running this, the contents of textfile2.txt should be:
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts