1Lingua::EN::Numbers::OrUdsienratCeo(n3t)ributed Perl DocLuimnegnutaa:t:iEoNn::Numbers::Ordinate(3)
2
3
4

NAME

6       Lingua::EN::Numbers::Ordinate -- go from cardinal number (3) to ordinal
7       ("3rd")
8

SYNOPSIS

10         use Lingua::EN::Numbers::Ordinate;
11         print ordinate(4), "\n";
12          # prints 4th
13         print ordinate(-342), "\n";
14          # prints -342nd
15
16         # Example of actual use:
17         ...
18         for(my $i = 0; $i < @records; $i++) {
19           unless(is_valid($record[$i]) {
20             warn "The ", ordinate($i), " record is invalid!\n";
21             next;
22           }
23           ...
24         }
25

DESCRIPTION

27       There are two kinds of numbers in English -- cardinals (1, 2, 3...),
28       and ordinals (1st, 2nd, 3rd...).  This library provides functions for
29       giving the ordinal form of a number, given its cardinal value.
30

FUNCTIONS

32       ordinate(SCALAR)
33           Returns a string consisting of that scalar's string form, plus the
34           appropriate ordinal suffix.  Example: "ordinate(23)" returns
35           "23rd".
36
37           As a special case, "ordinate(undef)" and "ordinate("")" return
38           "0th", not "th".
39
40           This function is exported by default.
41
42       th(SCALAR)
43           Merely an alias for "ordinate", but not exported by default.
44
45       ordsuf(SCALAR)
46           Returns just the appropriate ordinal suffix for the given scalar
47           numeric value.  This is what "ordinate" uses to actually do its
48           work.  For example, ordsuf(3) is "rd".
49
50           Not exported by default.
51
52       The above functions are all prototyped to take a scalar value, so
53       "ordinate(@stuff)" is the same as "ordinate(scalar @stuff)".
54

CAVEATS

56       * Note that this library knows only about numbers, not number-words.
57       "ordinate('seven')" might just as well be "ordinate('superglue')" or
58       "ordinate("\x1E\x9A")" -- you'll get the fallthru case of the input
59       string plus "th".
60
61       * As is unavoidable, "ordinate(0256)" returns "174th" (because ordinate
62       sees the value 174). Similarly, "ordinate(1E12)" returns
63       "1000000000000th".  Returning "trillionth" would be nice, but that's an
64       awfully atypical case.
65
66       * Note that this library's algorithm (as well as the basic concept and
67       implementation of ordinal numbers) is totally language specific.
68
69       To pick a trivial example, consider that in French, 1 ordinates as
70       "1ier", whereas 41 ordinates as "41ieme".
71

SEE ALSO

73       Lingua::EN::Inflect provides an "ORD" function, which returns the
74       ordinal form of a cardinal number.
75
76       Lingua::EN::Number::IsOrdinal provides an "is_ordinal" function, which
77       returns true if passed an ordinal number.
78
79       Lingua::EN::Numbers provides function "num2en_ordinal()" which will
80       take a number and return the ordinal as a word.  So 3 will result in
81       "third".
82

REPOSITORY

84       <https://github.com/neilb/Lingua-EN-Numbers-Ordinate>
85
87       Copyright (c) 2000 Sean M. Burke.  All rights reserved.
88
89       This library is free software; you can redistribute it and/or modify it
90       under the same terms as Perl itself.
91

AUTHOR

93       Sean M. Burke "sburke@cpan.org"
94
95       This has been maintained by Neil Bowers (NEILB) since 2014.
96
97
98
99perl v5.36.0                      2022-07-22  Lingua::EN::Numbers::Ordinate(3)
Impressum