|
Array.xor Method
Identify values that are in either of two Arrays, but not both.
object.xor (arr)
Arguments
- object
- Required. Always the name of an Array object.
- arr
- Required. The other array in the comparison.
Return Value
The Array.xor method returns an array containing the values that are in either array but not both.
Remarks
The following example illustrates the use of the Array.xor method.
// Let's create some arrays then compare them.
var a = new Array("a", "b", "c", "d", "b", "e", "d");
var a = new Array("c", "d", "e", "f", "d", "g", "e");
Console.Writeln(a.toString()); // returns "a,b,b,d,b,e,d"
Console.Writeln(b.toString()); // returns "c,d,e,f,d,g,e"
var x = a.and(b); // find the values that are in both arrays
var y = a.or(b); // find the values that are in either array
var z = a.xor(b); // find the values that are in one array or the other, but not both
Console.Writeln(x.toString()); // returns "c,d,e"
Console.Writeln(y.toString()); // returns "a,b,c,d,e,f,g"
Console.Writeln(z.toString()); // returns "a,b,f,g"
Requirements
Array.clone(), Array.and(), Array.or(), Array.unique(), Array.remove()
|