I want to compare 2 lines, but the one line is in a random sequence. I use text boxes, like this:
Textbox1:
friends
pals
elephant
Textbox2:
aspl
Now when I hit a button I want Textbox3 to show the following:
Textbox3:
pals
What I got so far:
Textbox3.Clear();
string[] lines1 = Textbox2.Lines;
foreach (string line1 in lines1)
{
string[] lines = Textbox1.Lines;
foreach (string line in lines)
{
if (line.Contains(line1))
{
Textbox3.Text += line;
Textbox3.Text += "\r\n";
}
}
}
But this will only copy the line to Textbox3 if the line in Textbox1 and Textbox2 is totally identical, not just if the characters is identical.
So my question is: How do I do that?