Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Pangram-checker/PowerShell/pangram-checker-1.psh
Normal file
13
Task/Pangram-checker/PowerShell/pangram-checker-1.psh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
|
||||
{
|
||||
$Text = $Text.ToLower()
|
||||
$Alphabet = $Alphabet.ToLower()
|
||||
|
||||
$IsPangram = @( $Alphabet.ToCharArray() | Where-Object { $Text.Contains( $_ ) } ).Count -eq $Alphabet.Length
|
||||
|
||||
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 'Съешь же ещё этих мягких французских булок, да выпей чаю' 'абвгдежзийклмнопрстуфхцчшщъыьэюяё'
|
||||
9
Task/Pangram-checker/PowerShell/pangram-checker-2.psh
Normal file
9
Task/Pangram-checker/PowerShell/pangram-checker-2.psh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
|
||||
{
|
||||
$alSet = [Collections.Generic.HashSet[char]]::new($Alphabet.ToLower())
|
||||
$textSet = [Collections.Generic.HashSet[char]]::new($Text.ToLower())
|
||||
|
||||
$alSet.ExceptWith($textSet) # remove text chars from the alphabet
|
||||
|
||||
return $alSet.Count -eq 0 # any alphabet letters still remaining?
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue