文本对比Text Diff
在线对比两段文本的差异Compare differences between two pieces of text online.
关于 文本对比About Text Diff
对比两版合同、配置或代码,靠肉眼找差异既低效又容易漏。本工具对两段文本逐行比较,高亮标出新增与删除的内容,并给出差异统计,让改动一目了然。Comparing two versions of a contract, config or code by eye is slow and error-prone. This tool diffs two texts line by line, highlighting additions and deletions with a change summary so every edit stands out.
使用方法How to Use
- 左侧粘贴原文,右侧粘贴新文本。Paste the original on the left and the new text on the right.
- 点击对比按钮。Click compare.
- 结果区以不同颜色高亮删除与新增的行。The result highlights deleted and added lines in different colours.
- 结合差异统计快速把握改动规模。Use the change summary to gauge the scale of edits at a glance.
常见问题FAQ
对比是按行还是按字符?Is the diff line-based or character-based?
以行为主进行对比,适合代码、配置与文档的版本比较;行内细微改动会体现在该行的删除/新增标记中。It is primarily line-based, suiting code, config and document versions; small in-line edits show up as delete/add marks on that line.
可以用来做代码审查吗?Can it be used for code review?
适合快速比较两个版本的差异;涉及三方合并、冲突解决的复杂场景,仍推荐使用 Git 等专业版本控制工具。It is great for quickly comparing two versions; for three-way merges and conflict resolution, professional version control like Git is still recommended.
我的文本会上传吗?Is my text uploaded?
不会。对比计算完全在浏览器本地完成,适合处理含敏感信息的合同与配置。No. The diff runs entirely in your browser, making it safe for sensitive contracts and configs.
相关阅读Related Reading
大小写转换不简单:土耳其语 i、Unicode 大小写与 locale 陷阱Case Conversion Is Not Trivial: Turkish i, Unicode Case Mapping and Locale Traps
`"I".toLowerCase()` 谁不会写?但在土耳其语 locale 下它返回的不是 "i" 而是 "ı"。本文从这个经典 bug 出发,讲清 Unicode 大小写映射的一对多、无条件映射与 locale 映射,以及数据库、URL、HTTP 头里的大小写坑Who can't write `"I".toLowerCase()`? But under a Turkish locale it returns "ı", not "i". Starting from this classic bug, this article explains Unicode one-to-many case mapping, unconditional vs locale-aware mapping, and the case pitfalls in databases, URLs and HTTP headers.
Diff 算法入门:LCS 与 Myers,以及代码评审中高效读 diff 的技巧Diff Algorithms 101: LCS and Myers, Plus Tricks for Reading Diffs in Code Review
`git diff` 每天都在用,但你知道它背后的算法吗?本文从最长公共子序列讲起,对比 LCS 与 Myers 的取舍,再给出代码评审中快速定位真实改动、忽略噪音的几个实用技巧You run `git diff` every day, but do you know the algorithm behind it? This article starts from the longest common subsequence, compares LCS versus Myers, and shares practical tricks for locating real changes and ignoring noise during code review.
相关工具Related Tools
文本去重/去空行Text Deduplicator
去除文本中的重复行和空行Remove duplicate lines and empty lines from text.
字数统计Word Counter
统计文本字符数、词数、行数Count characters, words and lines in text.
大小写转换Case Converter
英文文本大小写转换Convert English text between uppercase, lowercase and more.
Lorem Ipsum 生成Lorem Ipsum Generator
生成Lorem Ipsum占位文本Generate Lorem Ipsum placeholder text.