Template:Is century
FALSE
Usage
[edit]This template can be used in other templates to check or analyse an input entered in the the form Xth century
(ie. the format used in Works by century, Births by century and Deaths by century).
{{is century|input=|function=}}
The template can be used without named parameters as well. The most basic usage is:
{{is century|}}
Input
[edit]The input must be in the form of Xth century
or Xth century BCE
. The maximum value is 21st century
and the minimum value is 20th century BCE
. There is no 0th century
, so this will not work as an input.
Function
[edit]The function must be one of the numbers in this table. This parameter is optional. If not set, function 0 is the default.
Number | Function | Output |
---|---|---|
0 | Basic | Returns the last or first year of the century. (Last if Common Era, first if Before Common Era.) |
1 | Index | Returns a number counting the number of centuries from the 1st century BCE .ie. 1st century BCE = 0, 1st century BCE = 1, 2nd century BCE = -1 |
2 | Absolute | Returns the numeric part of the input only. Note that this will never return 0. |
3 | Logic | Returns a 1 (one) if the input is a recognised century. |
If the input is not a recognised century, this template will return FALSE
; unless function 3 is selected, in which case it will return 0 (zero).
Examples
[edit]Basic
[edit]{{is century|19th century}}
1899
{{is century|input=19th century}}
1899
{{is century|input=19th century|function=0}}
1899
{{is century|input=19th century BCE|function=0}}
1899 BCE
Index
[edit]{{is century|input=19th century|function=1}}
19
{{is century|input=1st century|function=1}}
1
{{is century|input=1st century BCE|function=1}}
0
{{is century|input=19th century BCE|function=1}}
-18
Absolute
[edit]{{is century|input=19th century|function=2}}
19
{{is century|input=1st century|function=2}}
1
{{is century|input=1st century BCE|function=2}}
1
{{is century|input=19th century BCE|function=2}}
19
Logic
[edit]{{is century|input=19th century|function=3}}
1
{{is century|input=1875|function=3}}
0
This is a year and not a century.
{{is century|input=Foo|function=3}}
0
Unrecognised input
[edit]{{is century|input=Foo}}
FALSE
{{is century|input=Foo|function=3}}
0
Notes
[edit]An alternative form of using function 3 (logic) is to combine this template with {{is number}}.
{{is number|{{is century|input=19th century|function=2}}}}
1
{{is number|{{is century|input=Foo|function=2}}}}