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;
}
@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.
Most helpful comment
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.