locked
I need Help with comparing RRS feed

  • Question

  • so im trying to compare two text boxes and write the differences to a different text box on a button click for example:

    textbox1.Text = "This is my name right here

    and my birthday is may 12"

    textbox2.Text = "This is my name right there

    and my birthday is may 25"

    //click compare button

    textbox3.Text = " Your differences are: Line 1, Here/There.

                                                              Line 2, 12/25 (Date)."

    //Date meaning the date you clicked the compare button and it being at end of your file text,  im also wanting it to save to a text file where i want and the name i want using a button click.  PLEASE HELP!!!

    Monday, December 16, 2013 5:48 AM

Answers

  • Step 1 : use the string[] w1 = string.split(' ') ; to get individual values to an array of words .

    Step 2 : use the string[] w2 = string.split(' ') ; to get individual values to an array of words  of second text box.

    step 3: use for(i=0-->i=w1.length) compare w1[i] and w2[i] if same then ignore else add into a string to provide 

    out put .

    If you want multiline output read lineby line from the multiline text box and do the same.

    • Proposed as answer by HariHaran A Monday, December 16, 2013 9:40 AM
    • Marked as answer by Haydon252 Monday, December 16, 2013 3:50 PM
    Monday, December 16, 2013 9:40 AM
  • Step 1 : use the string[] w1 = string.split(' ') ; to get individual values to an array of words .

    Step 2 : use the string[] w2 = string.split(' ') ; to get individual values to an array of words  of second text box.

    step 3: use for(i=0-->i=w1.length) compare w1[i] and w2[i] if same then ignore else add into a string to provide 

    out put .

    If you want multiline output read lineby line from the multiline text box and do the same.

    It will work if you dont have situation like this: 

    string1 = "This is my name right here and my birthday is may 12";
    string2 = "This is not my name right here and my birthday is may 12";
    they are almost identical but your code will give lot of warnings


    Monday, December 16, 2013 10:18 AM

All replies

  • Step 1 : use the string[] w1 = string.split(' ') ; to get individual values to an array of words .

    Step 2 : use the string[] w2 = string.split(' ') ; to get individual values to an array of words  of second text box.

    step 3: use for(i=0-->i=w1.length) compare w1[i] and w2[i] if same then ignore else add into a string to provide 

    out put .

    If you want multiline output read lineby line from the multiline text box and do the same.

    • Proposed as answer by HariHaran A Monday, December 16, 2013 9:40 AM
    • Marked as answer by Haydon252 Monday, December 16, 2013 3:50 PM
    Monday, December 16, 2013 9:40 AM
  • Step 1 : use the string[] w1 = string.split(' ') ; to get individual values to an array of words .

    Step 2 : use the string[] w2 = string.split(' ') ; to get individual values to an array of words  of second text box.

    step 3: use for(i=0-->i=w1.length) compare w1[i] and w2[i] if same then ignore else add into a string to provide 

    out put .

    If you want multiline output read lineby line from the multiline text box and do the same.

    It will work if you dont have situation like this: 

    string1 = "This is my name right here and my birthday is may 12";
    string2 = "This is not my name right here and my birthday is may 12";
    they are almost identical but your code will give lot of warnings


    Monday, December 16, 2013 10:18 AM
  • diff'ing is complicated. I would suggest searching for a library. I found this one : http://diffplex.codeplex.com/#What is the DiffPlex Project?

    Bob - www.crowcoder.com

    Monday, December 16, 2013 1:17 PM
  • Yup you are true . I have taken some assumptions as the requirement was not clear enough.There are even more cases that must be considered . 
    Tuesday, December 17, 2013 6:05 AM