Difference between revisions of "Template:AnA"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | + | The template is used to return the indefinite article - <code><nowiki>an</nowiki></code> or <code><nowiki>a</nowiki></code> for the given word. The template checks the first character of the string and does the following: | |
− | * for a, e, i, o, u, it | + | * for a, e, i, o, u, it returns an "an" |
− | * for other letters, | + | * for other letters, returns an "a" |
− | |||
'''NOTE:''' As any "printing" template, it doesn't store any values anywhere, but merely returns a value. | '''NOTE:''' As any "printing" template, it doesn't store any values anywhere, but merely returns a value. | ||
Line 13: | Line 12: | ||
-->{{#if: {{{1|}}}<!-- | -->{{#if: {{{1|}}}<!-- | ||
-->|<!-- | -->|<!-- | ||
− | -->{{#switch: {{#sub:{{{1}}}|0|1}}<!-- | + | -->{{#switch: {{lc:{{#sub:{{{1}}}|0|1}}}}<!-- |
-->|a<!-- | -->|a<!-- | ||
-->|e<!-- | -->|e<!-- | ||
-->|i<!-- | -->|i<!-- | ||
-->|o<!-- | -->|o<!-- | ||
− | -->|u=an | + | -->|u=an<!-- |
-->|b<!-- | -->|b<!-- | ||
-->|c<!-- | -->|c<!-- | ||
Line 39: | Line 38: | ||
-->|x<!-- | -->|x<!-- | ||
-->|y<!-- | -->|y<!-- | ||
− | -->|z=a | + | -->|z=a<!-- |
− | -->| | + | -->|<!-- if not a letter, nothing to return |
-->}}<!-- switch | -->}}<!-- switch | ||
-->}}<!-- if | -->}}<!-- if | ||
--><!-- | --><!-- | ||
--></includeonly> | --></includeonly> |
Latest revision as of 23:00, 9 January 2023
The template is used to return the indefinite article - an
or a
for the given word. The template checks the first character of the string and does the following:
- for a, e, i, o, u, it returns an "an"
- for other letters, returns an "a"
NOTE: As any "printing" template, it doesn't store any values anywhere, but merely returns a value.
Parameters:
string
- any string to which the article should be added.