2

我正在使用 google-diff-match-patch 比较 2 个字符串的差异。它在大多数情况下都可以正常工作,除非单词中的第一个字符相同。

例如:

Text1 = CHICAGO IL
Text2 = COLUMBUS OH

输出:

deltas: [Diff(EQUAL,"C"), Diff(DELETE,"HICAGO IL"), Diff(INSERT,"OLUMBUS OH")]
<span>C</span><span class='SS_ChangeDelete'>HICAGO IL</span><span class='SS_ChangeAdd'>OLUMBUS OH</span>

期望的输出:

deltas: [Diff(DELETE,"CHICAGO IL"), Diff(INSERT,"COLUMBUS OH")]
<span class='SS_ChangeDelete'>CHICAGO IL</span><span class='SS_ChangeAdd'>COLUMBUS OH</span>

任何建议或是否有任何其他图书馆可以解决问题?提前致谢

4

0 回答 0