13 lines
291 B
PowerShell
13 lines
291 B
PowerShell
# 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") |