DiffGranularity
is an option to Diff and related functions that indicates with what granularity to compare the given expressions.
Details
- Valid settings for DiffGranularity depend on the expressions being compared.
- Settings for DiffGranularity include:
-
"Lists" compare lists by item "Characters" compare strings character by character "Words" compare strings one word at a time "Lines" compare strings or files one full line at a time "Cells" compare one Cell with another "Notebooks" compare one Notebook with another - The default setting of Automatic will choose an appropriate granularity for the given expressions.
- The default granularity depends on the heads of the expressions being diffed:
-
List "Lists" String "Characters" BioSequence "Characters" Cell "Cells" ExpressionCell "Cells" TextCell "Cells" CellObject "Cells" Notebook "Notebooks" NotebookObject "Notebooks" File["file.nb"] "Notebooks" File[other] "Lines"
Examples
open allclose allBasic Examples (1)
By default, strings are compared as a sequence of characters:
Use DiffGranularity to treat strings as a sequence of lines instead:
Properties & Relations (1)
Use DiffGranularity to perform a diff of the raw text of notebook files, line by line:
Text
Wolfram Research (2024), DiffGranularity, Wolfram Language function, https://reference.wolfram.com/language/ref/DiffGranularity.html.
CMS
Wolfram Language. 2024. "DiffGranularity." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DiffGranularity.html.
APA
Wolfram Language. (2024). DiffGranularity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiffGranularity.html