Click here to Skip to main content
14,732,999 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am reading text file content into a string.
I want to replace first occurrence of a string with some other string second occurrence with some other string.
Is it possible to find first occurrence of a string in a file?
Posted
Comments
Kenneth Haugland 3-Oct-12 7:36am
   
Read the file into memory, search for the text, and return the line or whatever you want.

Using the IndexOf method of String class to check for the first occurrence a string.
Refer this link
http://msdn.microsoft.com/en-us/library/system.string.indexof(VS.100).aspx[^]
   
Hello ,

Google It You will get Answer.
Search a String
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900