Any existing C# code (OSS) that will calculate diff between two strings and output html? [closed]

不打扰是莪最后的温柔 提交于 2019-12-05 02:50:31

问题


I need to compare two strings and output the diff in HTML (similar to MS Word "track changes"). Language is C#, this is (not surprisingly) a .NET web app. There are a few similar questions (like this one for PHP/Python), but no existing question on SO.

I don't need a finished project, just anything that will cut out the extra work. I know this problem has been solved at least once. I'm looking to leverage from that starting place (source for an object, just a method, just an algorithm in C#, anything will be useful). Output for the diff needs to be in HTML.


回答1:


There is a C# class available from here (under a BSD licence) that will diff two textual inputs. If you download the source code, there is also some code that will turn this output into HTML. An example of its output can be found here.




回答2:


DiffPlex and Google Diff Match and Patch (via prettyHtml function) are some other open source options.



来源:https://stackoverflow.com/questions/1555531/any-existing-c-sharp-code-oss-that-will-calculate-diff-between-two-strings-and

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!