thats better
This commit is contained in:
parent
6bc0513124
commit
41ece0e405
1 changed files with 7 additions and 9 deletions
|
@ -20,15 +20,13 @@ namespace {
|
||||||
using util::types::i32, util::types::CStr;
|
using util::types::i32, util::types::CStr;
|
||||||
|
|
||||||
fn getOrdinalSuffix(const i32 day) -> CStr {
|
fn getOrdinalSuffix(const i32 day) -> CStr {
|
||||||
using matchit::match, matchit::is, matchit::_, matchit::or_;
|
using matchit::match, matchit::is, matchit::_, matchit::in;
|
||||||
|
|
||||||
if (day == 11 || day == 12 || day == 13)
|
return match(day)(
|
||||||
return "th";
|
is | in(11, 13) = "th",
|
||||||
|
is | (_ % 10 == 1) = "st",
|
||||||
return match(day % 10)(
|
is | (_ % 10 == 2) = "nd",
|
||||||
is | 1 = "st",
|
is | (_ % 10 == 3) = "rd",
|
||||||
is | 2 = "nd",
|
|
||||||
is | 3 = "rd",
|
|
||||||
is | _ = "th"
|
is | _ = "th"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue