Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace Function

Status
Not open for further replies.

tek1ket

MIS
Jan 25, 2009
70
IR
i have a ini file containe a line

FromPath=@"D:\Program Files"

i want to read this so,

System.IO.StreamReader objReader;
objReader = new System.IO.StreamReader(FileName);
do
{
txtline=objReader.ReadLine().ToLower().ToString();
if (txtline.IndexOf("frompath")>-1)
FromPath=txtline;

}while (objReader.Peek() != -1);

when i read the line i'll have it like this
"frompath=@\"d:\\program files\""
how can i replace \\ to \
and \" to "
???
 
These are just escape characters? When the text is output they should display as you require. anyway the answer to your question is
Code:
myString.Replace(oldstring, newString);

Age is a consequence of experience
 
Yes, those extra slashes are added by the IDE. Ignore them.

Chip H.


____________________________________________________________________
www.chipholland.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top