RosettaCodeData/Task/Pangram-checker/PowerShell/pangram-checker-2.psh

10 lines
392 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
Function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
{
$alSet = [Collections.Generic.HashSet[char]]::new($Alphabet.ToLower())
$textSet = [Collections.Generic.HashSet[char]]::new($Text.ToLower())
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
$alSet.ExceptWith($textSet) # remove text chars from the alphabet
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
return $alSet.Count -eq 0 # any alphabet letters still remaining?
}