-
Notifications
You must be signed in to change notification settings - Fork 1
ConvertTo DifferenceString
Converts two strings into a difference string, highlighting the differences between them.
ConvertTo-DifferenceString [-ReferenceString] <String> [-DifferenceString] <String>
[[-EqualIndicator] <String>] [[-NotEqualIndicator] <String>] [[-HighlightStart] <String>]
[[-HighlightEnd] <String>] [[-ReferenceLabel] <String>] [[-DifferenceLabel] <String>] [-NoColumnHeader]
[-NoLabels] [[-ReferenceLabelAnsi] <String>] [[-DifferenceLabelAnsi] <String>] [[-ColumnHeaderAnsi] <String>]
[[-ColumnHeaderResetAnsi] <String>] [[-EncodingType] <String>]
[<CommonParameters>]
The ConvertTo-DifferenceString command takes two strings, a reference string and a difference string, and converts them into a difference string that highlights the differences between the two strings. The function compares the byte values of each character in the strings and outputs the differences in a formatted manner. It supports customizing the indicators, labels, colors, and encoding type.
ConvertTo-DifferenceString -ReferenceString 'Hello' -DifferenceString 'Hallo'
Expected: But was:
Bytes Ascii Bytes Ascii
48 65 6C 6C 6F Hello == 48 61 6C 6C 6F Hallo
Converts the reference string 'Hello' and the difference string 'Hallo' into a difference string, highlighting the differences.
Specifies the ANSI escape sequence to apply to the column header.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the ANSI escape sequence to reset the column header.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the label for the difference string. Default is 'But was:'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: But was:
Accept pipeline input: False
Accept wildcard characters: False
Specifies the ANSI escape sequence to apply to the difference label.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the difference string to compare.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the encoding type to use for converting the strings to byte arrays. Default is 'UTF8'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 13
Default value: UTF8
Accept pipeline input: False
Accept wildcard characters: False
Specifies the indicator to use for equal bytes. Default is '=='.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: ==
Accept pipeline input: False
Accept wildcard characters: False
Specifies the ANSI escape sequence to end highlighting. Default is "[0m" (reset color).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: [0m
Accept pipeline input: False
Accept wildcard characters: False
Specifies the ANSI escape sequence to start highlighting. Default is "[31m" (red color).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: [31m
Accept pipeline input: False
Accept wildcard characters: False
Specifies whether to exclude the column header from the output.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies whether to exclude the labels from the output.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the indicator to use for not equal bytes. Default is '!='.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: !=
Accept pipeline input: False
Accept wildcard characters: False
Specifies the label for the reference string. Default is 'Expected:'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: Expected:
Accept pipeline input: False
Accept wildcard characters: False
Specifies the ANSI escape sequence to apply to the reference label.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the reference string to compare against.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.