Hi...I wrote a proggy that replace some words in text file
there is a condition that if somebody write in the texbox ","...all sentences change into plural form...

if (systemTEXT->Text->Contains(",")) {token == 1;}

it works great...text contains "," - it means plural forms are needed..token=1

if (linia->Contains("system_token")) {poprawka = linia->Replace( "system_token", systems );}
else
if (linia->Contains("when_token")) {poprawka = linia->Replace( "when_token", date1 );}
else
if (linia->Contains("reason_token")) {poprawka = linia->Replace( "reason_token", descriptionpl );}
else
//this part doesnt work--------------
if (token=1 & line->Contains("poniższy system będzie")) {poprawka = linia->Replace( "poniższy system będzie", "poniższe systemy będą" );}
else
if (token=1 & line->Contains("poniższy system będzie")) {poprawka = linia->Replace( "DOSTĘPNY", "DOSTĘPNE" );}
else
if (token=1 & line->Contains("System")) {poprawka = linia->Replace( "System", "Systemy" );}
//----------------------------------
			else {poprawka=linia;}

Unfortunatelly if (token=1 & linia->) parts dont work...there are no errors...but program ALWAYS change texts from 1st IF...even if token=0...
rest of IFs dont work at all....no changes for token=1 and token=0...
ofcourse TEXT I want to change appears in the file.

Please HELP. Thanks!

if(token == 1 && line->Contains("System")) You had token = 1, which assigns 1 to token, which makes it automatically true (non-zero). Also, & is a bitwise and, && is used for comparison.

No errors but it still doesnt work...it doesnt change anything from token==1 part

StreamWriter^ plik2 = gcnew StreamWriter("RESULT\\result.html");
StreamReader^ plik1 = gcnew StreamReader(path,System::Text::Encoding::Default);

			while (line=plik1->ReadLine()) 
		    {
			if (line->Contains("system_token")) {poprawka = linia->Replace( "system_token", systems );}
			else
			if (line->Contains("when_token")) {poprawka = linia->Replace( "when_token", date1 );}
			else
			if (line->Contains("reason_token")) {poprawka = linia->Replace( "reason_token", descriptionpl );}
			else
			if (token==1 && line->Contains("poniższy system będzie")) {poprawka = linia->Replace( "poniższy system będzie", "poniższe systemy będą" );}
			else
			if (token==1 && line->Contains("DOSTĘPNY")) {poprawka = linia->Replace( "DOSTĘPNY", "DOSTĘPNE" );}
			else
			if (token==1 && line->Contains("System:")) {poprawka = linia->Replace( "System:", "Systemy:" );}
			else {poprawka=line;}
			plik2->WriteLine(poprawka);
		    }
			plik1->Close();
			plik2->Close();
			System::Diagnostics::Process::Start("RESULT\\result.html");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.