Diff.Match.Patch icon indicating copy to clipboard operation
Diff.Match.Patch copied to clipboard

comparing two textbox string issue

Open aayushibabariya opened this issue 4 years ago • 0 comments

I am comparing two string

problem is that not get expected output

when I enter run time:

This is my testing for matching algoritham - first string

This is my testing for matchings algoritham for application by website - second string

see my output:

image

when I remove the is keyword then I dont want to display in param1:

what I want to:

testing matching testings matchings

WebForm1.aspx.cs

       protected void Button1_Click(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Label1.Text = "";
                Label2.Text = "";
            }
     
            var slist = stextbox.Text.Split(' ');
            var flist = ftextbox.Text.Split(' ');

            int minWordCount = Math.Min(slist.Length, flist.Length);

            var diffWords = slist.Take(minWordCount).Where(x => flist.Contains(x) == false).ToList();

            var diffWordsf = flist.Take(minWordCount).Where(x => slist.Contains(x) == false).ToList();

           Label2.Text = "param2:" + string.Join("  ", diffWords);

            Label1.Text = "param1:" + string.Join("  ", diffWordsf);
        } 
     }

.aspx

<asp:TextBox ID="ftextbox" runat="server" TextMode="MultiLine" Width="500px" Height="200px"></asp:TextBox>
<asp:TextBox ID="stextbox" runat="server" TextMode="MultiLine" Width="500px" Height="200px"></asp:TextBox>

please help

aayushibabariya avatar Oct 08 '20 05:10 aayushibabariya