Skip to content

Out Difference

viscalyxbot edited this page Feb 4, 2025 · 2 revisions

Out-Difference

SYNOPSIS

Compares two sets of strings and converts them into a difference string.

SYNTAX

Out-Difference [-Reference] <String[]> [-Difference] <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>] [-ConcatenateArray]
 [[-ConcatenateChar] <String>] [-NoHexOutput] [<CommonParameters>]

DESCRIPTION

The Out-Difference function compares two sets of strings, Reference and Difference, and converts them into a difference string. It provides options to customize the indicators, labels, and formatting of the output.

EXAMPLES

EXAMPLE 1

$reference = "apple", "banana", "cherry"
$difference = "apple", "orange", "cherry"
Out-Difference -Reference $reference -Difference $difference -EqualIndicator '' -ReferenceLabel 'Reference:' -DifferenceLabel 'Difference:' -ConcatenateArray -ConcatenateChar '' -NoHexOutput

PARAMETERS

-ColumnHeaderAnsi

Specifies the ANSI escape sequence for the column header.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ColumnHeaderResetAnsi

Specifies the ANSI escape sequence to reset the column header formatting.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ConcatenateArray

Indicates whether to concatenate the arrays of strings into a single string.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ConcatenateChar

Specifies the character used to concatenate the strings. Default is a new line character.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 14
Default value: [System.Environment]::NewLine
Accept pipeline input: False
Accept wildcard characters: False

-Difference

Specifies the difference set of strings to compare.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DifferenceLabel

Specifies the label for the difference set.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DifferenceLabelAnsi

Specifies the ANSI escape sequence for the difference label.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EncodingType

Specifies the encoding type to use for converting the strings to byte arrays.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EqualIndicator

Specifies the indicator to use for equal strings.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-HighlightEnd

Specifies the ending indicator for highlighting differences.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-HighlightStart

Specifies the starting indicator for highlighting differences.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NoColumnHeader

Indicates 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

-NoHexOutput

Specifies whether to omit the hex columns and output only the character groups.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-NoLabels

Indicates 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

-NotEqualIndicator

Specifies the indicator to use for unequal strings.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Reference

Specifies the reference set of strings to compare.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ReferenceLabel

Specifies the label for the reference set.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ReferenceLabelAnsi

Specifies the ANSI escape sequence for the reference label.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None. You cannot pipe input to this function.

OUTPUTS

System.String. The difference string representing the comparison between

the reference and difference sets.

NOTES

This command is using the default parameters values from the ConvertTo-DifferenceString command.

RELATED LINKS

Clone this wiki locally