Seddryck / Expressif

Expressif is the variable substitution syntax combined with a library of predicates and functions. Initially designed for NBi.io, Expressif allows you to define variables, transformations of these variables (with expressions and functions), in plain text, which can then be interpreted by the engine. Same can be done with predicates.
Apache License 2.0
1 stars 0 forks source link

Function to convert a positive integer to an ordinal text #137

Open Seddryck opened 1 year ago

Seddryck commented 1 year ago

The basic idea of the function ordinal(culture) is to convert 1 to 1st, 2 to 2nd, 3 to 3rd, 4 to 4th, 11 to 11th ...

It should accept an optional parameter, the culture (i.e. en-US, fr-fr, ...) by default it applies en-GB.

11 | ordinal  => 11th
11 | ordinal(en-us)  => 11th
11 | ordinal(fr-fr)  => 11e
11 | ordinal(nl-be)  => 11de
11 | ordinal(pt-pt) => 11º

More info on https://github.com/BenjaminVanRyseghem/numbro/tree/develop/languages