September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -3,7 +3,7 @@ function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrst
|
|||
$Text = $Text.ToLower()
|
||||
$Alphabet = $Alphabet.ToLower()
|
||||
|
||||
$IsPangram = $Alphabet.ToCharArray().Where{ $Text.Contains( $_ ) }.Count -eq $Alphabet.Length
|
||||
$IsPangram = @( $Alphabet.ToCharArray() | Where-Object { $Text.Contains( $_ ) } ).Count -eq $Alphabet.Length
|
||||
|
||||
return $IsPangram
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
|
||||
{
|
||||
$Text = $Text.ToLower()
|
||||
$Alphabet = $Alphabet.ToLower()
|
||||
Function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
|
||||
{
|
||||
$alSet = [Collections.Generic.HashSet[char]]::new($Alphabet.ToLower())
|
||||
$textSet = [Collections.Generic.HashSet[char]]::new($Text.ToLower())
|
||||
|
||||
$IsPangram = ( $Alphabet.ToCharArray() | Where { $Text.Contains( $_ ) } ).Count -eq $Alphabet.Length
|
||||
$alSet.ExceptWith($textSet) # remove text chars from the alphabet
|
||||
|
||||
return $IsPangram
|
||||
}
|
||||
|
||||
Test-Pangram 'The quick brown fox jumped over the lazy dog.'
|
||||
Test-Pangram 'The quick brown fox jumps over the lazy dog.'
|
||||
Test-Pangram 'Съешь же ещё этих мягких французских булок, да выпей чаю' 'абвгдежзийклмнопрстуфхцчшщъыьэюяё'
|
||||
return $alSet.Count -eq 0 # any alphabet letters still remaining?
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue