end of day 4 week 1
This commit is contained in:
13
week 1/day 4/exo2.ps1
Normal file
13
week 1/day 4/exo2.ps1
Normal file
@@ -0,0 +1,13 @@
|
||||
# exo 2
|
||||
# return the number of character of a string only if they're letter
|
||||
|
||||
$text = Read-Host('please enter a phrase')
|
||||
$counter = 0
|
||||
|
||||
foreach ($char in $text.ToCharArray()) {
|
||||
if($char -match '[A-Za-z]'){
|
||||
$counter++
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host("your string contain ${counter} character")
|
||||
Reference in New Issue
Block a user