Click here to Skip to main content
15,915,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a text file and in that, i have lines,
Width=200
Height=100
Signaturelink=http://www.google.com/[^]

i want to take all the values after the equal signal separately. How can i do that in c#? In some point, i want this text file to be cleared, how can i also achieve that?
Posted
Updated 18-Aug-12 0:30am
v2

Hi,

You have two question,
Answer for 1)
You need to read text file line by line and then split your text line by equal(=) sign and take 2nd value from returned Array object. but make sure you have only one equal sing in a line.

Answer for 2)
You can Remove content of text file by writing empty string in text file.

Hope you got the idea,

Best of luck
Thanks
-Amit Gajjar
 
Share this answer
 
Comments
ridoy 18-Aug-12 6:56am    
right solution
AmitGajjar 18-Aug-12 7:09am    
Thank you.
phantomlakshan 18-Aug-12 15:41pm    
Thanks, i'll try
AmitGajjar 18-Aug-12 22:37pm    
welcome.
You can read the file with a StreamReader[^] into a String[^] with the ReadLine()[^] method. You can then separate the two parts of the String with the Split()[^] method. The rest should be fairly easy for you to figure out.
 
Share this answer
 
Comments
phantomlakshan 18-Aug-12 15:41pm    
thanks

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