OrdinalWordsTransformation class

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

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

The current implementation assumes the input int is representable in 64 bits, even though integers on the web are not constrained as such.

const transformation = OrdinalWordsTransformation();

// 'first'
transformation.transform(1);

// 'second'
transformation.transform(2);

// 'hundred and fourth'
transformation.transform(104);
Inheritance
Available Extensions

Constructors

OrdinalWordsTransformation()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
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