Template:An

From A KoL Wiki
{{An}}
<phptag>

$first_letter_vowel = preg_match('/^[aeiou]/i',$argv[1]); $first_letter_cap = (preg_match('/^[A-Z]/',$argv[1])); if (isset($argv[2])) { if ($argv[2] == 'y') { $first_letter_cap = FALSE; } if ($argv[2] == 'n') { $first_letter_cap = TRUE; } } if ($first_letter_vowel) { if ($first_letter_cap) { echo "An "; } else { echo "an "; } } else { if ($first_letter_cap) { echo "A "; } else { echo "a "; } } echo $argv[1]; </phptag>

[[Category:Utility Templates]]

This template adds a leading article (a or an) based solely on the first letter of the string. It will also match the capitalization of the item ("an apple" vs. "An Apple") unless a second argument of Y is passed along to force lowercase (Y) or uppercase (N).

Usage

{{an|igloo}}

  • an igloo

{{an|Igloo}}

  • An Igloo

{{an|tent}}

  • a tent

{{an|Tent}}

  • A Tent

{{an|Igloo|y}}

  • an Igloo

{{an|Tent|y}}

  • a Tent

{{an|igloo|n}}

  • An igloo

{{an|tent|n}}

  • A tent