Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Vowels and Consonants using PowerShell
WhatsApp
Dorababu Meka
Jul 19
2016
3.2
k
0
0
function VowelsandConsonants
{
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[
string
] $InputString
)
[
string
] $VowelString
[
string
] $ConsonantsString
$StringLength = @()
$StringLength = $InputString.Length
for
($i=0;$i -lt $StringLength;$i++)
{
if
($InputString[$i] -eq
"a"
-or $InputString[$i] -eq
"e"
-or $InputString[$i] -eq
"i"
-or $InputString[$i] -eq
"o"
-or $InputString[$i] -eq
"u"
)
{
$VowelString = $VowelString + $InputString[$i]
}
else
{
$ConsonantsString = $ConsonantsString + $InputString[$i]
}
}
Write-Host
"`n Vowles are !"
$VowelString -foregroundcolor
"green"
Write-Host
"`n Vowles are !"
$VowelString.Length -foregroundcolor
"green"
Write-Host
"`n Consonants are !"
$ConsonantsString -foregroundcolor
"red"
Write-Host
"`n Consonants are !"
$ConsonantsString.Length -foregroundcolor
"red"
}
VowelsandConsonants
Vowels and Consonants
Up Next
Vowels and Consonants using PowerShell