The result of this function would typically not be included directly in the merged document, but would be used in a conditional, such as:
If
«When(StartsWithVowel(Fruit),an,a)» «Fruit»
is ripe it tastes better than if it is rotten.
The function assumes that ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ (and their uppercase variants) are the only vowels. Sometimes letters like ‘H’ are regarded as vowels. This would be indicated in the following way:
If
«When(StartsWithVowel(Fruit,"hH"),an,a)» «Fruit»
is ripe it tastes better than if it is rotten.
This function is only of use in the case where the template is being prepared for an English language document. For other languages, the article Testing parts of a string will be useful.