Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # define a set
- $x = [System.Collections.Generic.HashSet[string]]::new()
- 'python'.ToCharArray().foreach({[void]$x.add($_)})
- $y = [System.Collections.Generic.HashSet[string]]::new()
- 'powershell'.ToCharArray().foreach({[void$y.add($_)})
- $x.ExceptWith($y) # All the elements in x but not in y
- # union
- $x.UnionWith($y) # Unique elements in x or y or both
- # intersection
- $x.IntersectWith($y) # Elements in both x and y
- $x.SymmetricExceptWith($y) # Elements in x or y but not in both
Add Comment
Please, Sign In to add comment