Comparison Options for Whitespace Characters
Whitespace characters are any of the following: space, tab, carriage return, and line feed. You can change the comparison options for whitespace characters from the Tools | Comparison Options menu.
When the Compare as is option is enabled, Text A is considered equal to Text B if characters in Text A (including whitespace characters) correspond to those in Text B. The whitespace characters are relevant for comparison.
When the Normalize option is enabled, Text A is equal to Text B if, after normalization, characters in Text A correspond to those in Text B. “Normalization” means that multiple consecutive occurrences of whitespace characters are replaced by a single space character. Also, the leading and trailing whitespace characters are trimmed for each line of text.
Note: | In case of XML ( ) comparison, the leading and trailing whitespace characters in element and attribute values are trimmed. |
When the Strip all option is enabled, Text A is considered equal to Text B if, after stripping whitespace characters, characters in Text A correspond to those in Text B. In other words, any whitespace characters are stripped from the text and considered not relevant for comparison.
Note: | In case of XML comparison ( ), whitespace characters that are outside attribute or element values are disregarded for comparison. This is true for any of the whitespace options above. |
The following table illustrates differences when comparing text with each option, using text ( ) or Word comparison.
Text A | Text B | As is | Normalize | Strip |
---|---|---|---|---|
"a" | "a " | not equal | equal | equal |
"a" | " a" | not equal | equal | equal |
"a a" | "a a" | not equal | equal | equal |
The following table illustrates differences when comparing text with each option, using XML ( ) comparison.
Text A | Text B | As is | Normalize | Strip |
---|---|---|---|---|
<?xml version="1.0" | <?xml version="1.0" | equal | equal | equal |
<book id="1"> | <book id=" 1 "> | not equal | equal | equal |
<author>Mark Twain</author> | <author>Mark Twain</author> | not equal | equal | equal |