Click to See Complete Forum and Search --> : Need help on the coding , ReadLine


nextdoornextdoor
June 26th, 2007, 05:43 AM
The following is the coding
The problem of the coding is that it cant replace words that is held together like
eg

Auotname
Autonick

Autoname/Autonick

is there any problem in my while or if else?
can anyone help me plss
Thank you

+++++++++++++++++++++++++++++++++++++++++++++++++++++
StreamWriter^ writer = gcnew StreamWriter(filestream);

String^ str;
while ((str = din->ReadLine()) != nullptr)
{
if (str->IndexOf("Autoname") >= 0)
{
writer->WriteLine(str->Replace("Autoname",this->txtName->Text));
}
else if(str->IndexOf("Autonick") >= 0)
{
writer->WriteLine(str->Replace("Autonick",this->txtNick->Text));
}
else
{
writer->WriteLine(str);
}
} //end while

writer->Close();

Krishnaa
June 26th, 2007, 07:52 AM
is there any problem in my while or if else?
can anyone help me plss




This is the time for you to debug and see it for yourself.

nextdoornextdoor
June 26th, 2007, 02:33 PM
This is the time for you to debug and see it for yourself.


Hi , i have debug it , everything seemed fine .
the only problem is that it can replace every single words
eg

Auotname / Autonick

it will only replace Autoname but not Autonick
is it because i have place wrongly in my while and if or is there anyone can help me in this thank you