Runtime: No .IsVowel for chars??

Created on 12 Oct 2017  Â·  3Comments  Â·  Source: dotnet/runtime

Moved from https://github.com/aspnet/Docs/issues/4509. Originally filed by @Rasmustof.

Hey Guys,

i was just working on a simple program, but wished that there was a method for checking if any given >character is a vowel or not?

Usage would be like:
Char c = 'C'
if(isVowel(c))

etc..

this could be done like this if im not wrong:

Public bool isVowel(Char c){
string v = "aeiouyAEIOUY";
if(v.IndexOf(c) != -1){
return true;
}else return false;
}

Most helpful comment

I am not a globalization person

And even without globalization, whether certain letters represents vowels or consonants can change, e.g. the 'y' in the example might sometimes represent vowels and sometimes consonants, depending on usage.

I don't think we should add a method like this.

All 3 comments

@rasmustof I am not a globalization person, but this would not seem a good fit for Char as it is surely culture specific. Char.IsUpper can use the well defined UnicodeCategory but I am not aware of another universal definition for vowels. If there is some well defined concept for many locales, and it is defined in standard platforms like libicu, it might be a candidate for exposing, but probably not on Char. I would use your own method.

I am not a globalization person

And even without globalization, whether certain letters represents vowels or consonants can change, e.g. the 'y' in the example might sometimes represent vowels and sometimes consonants, depending on usage.

I don't think we should add a method like this.

Yeah, I was going to say, both y and w are semivowels. It's not just cultural– it's flagrantly arbitrary within each culture.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jzabroski picture jzabroski  Â·  3Comments

noahfalk picture noahfalk  Â·  3Comments

Timovzl picture Timovzl  Â·  3Comments

chunseoklee picture chunseoklee  Â·  3Comments

jchannon picture jchannon  Â·  3Comments