Files
7-Modern-Languages-in-7-Wee…/week 1/day 4/exo2.ps1
2026-01-22 07:31:44 +01:00

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")