如何比较两个文件并在浏览器中并排显示差异? [英] How to Compare two files and show the diffs in browser side by side ?

查看:140
本文介绍了如何比较两个文件并在浏览器中并排显示差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个基于Web的功能,我可以比较两个文件的差异,并在浏览器中并排显示结果,就像我们在TFS中的功能一样,同时比较两个版本的代码。



我想以突出显示的颜色显示更改。



我相信JQuery或c#Code必须有一些方法。



我用Google搜索并找到了一些链接,但这对我来说并不富有成效,任何帮助都将受到高度赞赏。

I want to implement a web based functionality, where i can compare two files differences and show the result in the browser side by side like the functionality we have in TFS while comparing two version of code.

I want to show the changes in highlighted colors.

I believe there must be some wayouts by JQuery or c# Code.

I googled and found few links but it was not fruitful to me, any help will be highly appreciated.

推荐答案

这里最困难的部分是:如何定义什么是差异?然而,有所谓的差异算法,它们确实非常有用且有用。它们提供的输出显示了新旧文本,您可以走的方式抛出一系列不匹配。请参阅,例如: http://ejohn.org/projects/javascript-diff-algorithm/ [ ^ ]。



-SA
The most difficult part here is: how to define what is "diff"? Nevertheless, there are so called "diff" algorithms which are really informative and useful. They provide the output showing both old and new text the way you can walk throw a sequence of mismatches. Please see, for example: http://ejohn.org/projects/javascript-diff-algorithm/[^].

—SA


这篇关于如何比较两个文件并在浏览器中并排显示差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆