To Count Number of Vowels.
STR = “VowelConstantA”
counter = 0
For i=1 to Len(STR)
If Chr(Asc(Mid(lcase(STR),i,1))) = “a” or Chr(Asc(Mid(lcase(STR),i,1))) = “e” or Chr(Asc(Mid(lcase(STR),i,1))) = “i” or _
Chr(Asc(Mid(lcase(STR),i,1))) = “o” or Chr(Asc(Mid(lcase(STR),i,1))) = “u” Then
counter = 0
For i=1 to Len(STR)
If Chr(Asc(Mid(lcase(STR),i,1))) = “a” or Chr(Asc(Mid(lcase(STR),i,1))) = “e” or Chr(Asc(Mid(lcase(STR),i,1))) = “i” or _
Chr(Asc(Mid(lcase(STR),i,1))) = “o” or Chr(Asc(Mid(lcase(STR),i,1))) = “u” Then
counter = counter + 1
End if
Next
msgbox counter
End if
Next
msgbox counter
No comments:
Post a Comment