I've checked other answers and they only cater for the vowels 'aeiouy', is there an easy of checking for any and all vowels - to include other alphabets too such as the 'ü' vowel in German?

var easy = 'a';
var hard = 'ü';
var etc = 'ö';
var andSoOn = 'あ';

If it's a question of just creating a loop and checking against it like in the selected answer to this question How do I check for vowels in JavaScript? is there a list of known vowels to use?

有帮助吗?

解决方案

is there an easy of checking for any and all vowels?

is there a known list of possible vowels?

Not if you want to be accurate. Have a look at the definition of a written vowel in Wikipedia:

In writing systems based on the Latin alphabet, the letters A, E, I, O, U, and sometimes Y are all used to represent vowels. However, not all of these letters represent vowels in all languages, or even consistently within one language (some of them, especially W and Y, are also used to represent approximants). Moreover, a vowel might be represented by a letter usually reserved for consonants, or a combination of letters, particularly where one letter represents several sounds at once, or vice versa; examples from English include igh in "thigh" and x in "x-ray". In addition, extensions of the Latin alphabet have such independent vowel letters as Ä, Ö, Ü, Å, Æ, and Ø.

...

Other languages cope with the limitation in the number of Latin vowel letters in similar ways. Many languages make extensive use of combinations of letters to represent various sounds. Other languages use vowel letters with modifications, such as Ä in Scandinavian and Nordic languages, or add diacritical marks, like umlauts, to vowels to represent the variety of possible vowel sounds. Some languages have also constructed additional vowel letters by modifying the standard Latin vowels in other ways, such as æ or ø that are found in some of the Scandinavian languages.

...

The alphabets used to write the Semitic languages, such as the Hebrew alphabet and the Arabic alphabet, do not ordinarily mark all the vowels, since they are frequently unnecessary in identifying a word.

In summary, you need to identify the language first, then you need a set of rules for vowels in that language, then you need a list of exceptions to the rules.

其他提示

A different approach than trying to build a big list of symbols is to work on a phonetic representation. The vowels in this representation are these Unicode code points : Unicode code points for phonetic vowels.

Of course this shifts the burden to finding a proper phonetic translation for each language.

This Chinese vowel diagram should give you an impression of how enormous your task is in general.

Use a regular expression to test a string for a range of vowels

var patt = /[üaö]/ //all values
var match = patt.test('ddddüdddd'); //string to match against, returns true or false
alert(match); //will return true because of the german vowel
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top