How to find difference between two strings?

前端 未结 1 676
感动是毒
感动是毒 2020-12-04 19:47

I have two strings and would like to display the difference between them. For example, if I have the strings \"I am from Mars\" and \"I am from Venus\", the output could be

相关标签:
1条回答
  • 2020-12-04 20:33

    Check this out: http://en.wikipedia.org/wiki/Diff#Algorithm

    Also: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem

    There is also an implementation described here: http://www.codeproject.com/KB/recipes/DiffAlgorithmCS.aspx

    0 讨论(0)
提交回复
热议问题