To calculate Vowel,consonant, and special character

To calculate Vowel,consonant, and special character

Hi,

I would like to determine the number of vowel and consonant in a string

For instance :

str word= “Michael John @!#$&^_*&”;
str vowel = “A I U E O”;

str consonant;

str character;

int checVowel = strLen(strKeep (word,vowel));

info (strFmt(“Vowel : %1”,checVowel));

I would like the result either str consonant= 7 ( the number of consonant in word), str character= 11 ( the number of character in word)

Is there a function to perform this calculation ?

I don’t understand exactly the part where you’re explain the requirement (“I would like the result either str consonant= 7 ( the number of consonant in word), str character= 11 ( the number of character in word)”).

Could you elaborate it, please? An example of the expect result would be helpful.

like word = Michael John @!#$&^*&
and the result is :
vowel 4 (iaeo)
consonant 7 (MCHLJHN)
character 11 ( @!#$&^
*&) include space

If you’re satisfied with your definition of vowels , then you’ve already calculated number of vowels (checVowel) and you can use the same approach to calculate consonants.

Nevertheless I don’t understand how you want to get 11. Maybe you have some definition of “word” unknown to me.

Note that the problem is quite complex, if you want to address it properly. For example, Y in English is both vowel and consonant, depending on context. And it’s clearly not the same in all languages.

Aha, so by “characters” you mean something like “special characters” and not “all characters”. It’s confusing, because vowels and consonants are vowels too.

If your definition of “characters” includes numbers, simply calculate total length with strLen() and subtract number of vowels and consonants. If it doesn’t, calculate numbers and subtract this value too.