I have variables which search specific words between two words
> string number207 = FindTextBetweenWithout(fileTTT, "\n207 ", " 20");
> string number208 = FindTextBetweenWithout(fileTTT, "\n208 ", " 20");
> string number209 = FindTextBetweenWithout(fileTTT, "\n209 ", " 20");
> string number219 = FindTextBetweenWithout(fileTTT, "\n219 ", " 20");
After i have a text file which contain numbers:
>207
>208
>209
>1402
>132
This numbers read with this method
var listChrt = File.ReadAllText(textBox2.Text);
So after i tried to compare this numbers
string compare()
{
if (listChrt.Contains("207"))
{
return number207;
}
if (listChrt.Contains("208"))
{
return number208;
}
if (listChrt.Contains("1402"))
{
return number1402;
}
return " ";
}
and i tried pass it into TextBox
richTextBox1.Text = (
dss()
);
But only get first return line which is number207.
As i undestood if else statement ends when it find true, but i need something to iterate through all my text file and find compares to my existed varibles(string number207,208 etc)
Aucun commentaire:
Enregistrer un commentaire