Start the differencing and returns the [[Diff]].
Unless turned off, lineDiff requests a line-by-line comparison. Line-by-line comparison is very different from other types of comparison for several reasons:
The non-line-diff algorithms show changes with strikeout and bold. Text that is present in one String but not the other is displayed in both results, but shown with strikeout in the String where is wasn't present and bold in the String where it was present. If a bit of text has been replaced with another piece of text, the text from the opposite string is shown with strikeout, followed by the replacement text in bold. Using this type of highlighting it is not necessary to display both the original and current versions. Normally just the current version is shown since the highlighting shows all text from both versions.
This is a numeric, code value. If the sample value is -1, then a phrase-based diff will be used. If the sample value is 0 then a word-based diff will be used. If the sample is 1 or greater, then a character based diff will be used where the "sample" value is the minimum number of consecutive character that must match following a non-matching sequence and thus mark the end of the changed region. The default value is 0.
If using the line-based diff, then in modified lines a secondary diff algorithm may run to find changes within each line. This parameter determines what diff algorithm will be used during the secondary phase.
This is a floating-point value used exclusively by the line diff algorithm. It is a percentage between 0.0 and 100.0. When a line is found to be changed, then a secondary diff algorithm is used to find changes within the line. Sometimes the line is completely different, and sometimes only a small part of the line is changed. Most times when there is a complete change of the line to something different, there are still characters here and there or even whole words that match between the two separate lines. However, it looks ridiculous to mark the entire original line with strikeout (except for a single word or a few characters) and then show the entire current line in bold. The sensitivity parameter indicates what percent of the line must match the original before differences are highlighted. If sensitivity is 100.0 then a secondary diff is not even attempted because only a 100% match would cause the differences to be highlighted, and it's already been proven that the lines do not match 100%.
DiffBuilder is used to configure the differencing engine. Four different algorithms can be used to identify and mark differences by comparing a line at a time, a phrase at a time, a word at a time or character sequences. The
find()
function returns the [[Diff]] object with properties to explore and display the differences between the two input strings.Example