OrdinalNumericalTransformation class

A transformation to convert an input int into numerical ordinal form.

This transformation converts the input to its numerical ordinal form (1 becomes 1st, 2 becomes 2nd etcetera). Negative inputs are supported, even though the usage of negative ordinals is at best unorthodox.

The input is formatted using numberFormat, which defaults to inputFormat.decimalPattern() if unspecified. The grammaticalGender can also be specified, though it currently has no effect (but may with future non-English implementations).

const transformation = OrdinalNumericalTransformation();

// '1st'
transformation.transform(1, 'en');

// '2nd'
transformation.transform(2, 'en');

// '104th'
transformation.transform(104, 'en');

// '1,113th'
transformation.transform(1113, 'en');
Inheritance
Available Extensions

Constructors

OrdinalNumericalTransformation({GrammaticalGender grammaticalGender = GrammaticalGender.neuter, NumberFormat? numberFormat})
const

Properties

grammaticalGender → GrammaticalGender
The grammatical gender to apply during transformation if relevant to the target locale.
final
hashCode int
The hash code for this object.
no setterinherited
numberFormat → NumberFormat?
The NumberFormat with which to format the input int.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
transform(int input, String locale) String
Transforms input into an instance of U using the provided locale.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited