Skip to main content
Version: 4.0 (next)

Humanizer.INumberToWordsConverter

INumberToWordsConverter Interface​

Converts numbers into locale-specific words, ordinals, and tuple names.

public interface INumberToWordsConverter

Methods​

INumberToWordsConverter.Convert(long) Method​

Converts the number using the locale's default grammatical gender.

string Convert(long number);
Parameters​

number System.Int64

The number to convert.

Returns​

System.String
The localized words for number.

INumberToWordsConverter.Convert(long, bool) Method​

Converts the number using the locale's default grammatical gender and optionally inserts the locale-specific conjunction.

string Convert(long number, bool addAnd);
Parameters​

number System.Int64

The number to convert.

addAnd System.Boolean

true to insert the locale-specific conjunction in compound numbers; otherwise, false.

Returns​

System.String
The localized words for number.

INumberToWordsConverter.Convert(long, bool, WordForm) Method​

Converts the number using the locale's default grammatical gender, the specified word form, and optional conjunction handling.

string Convert(long number, bool addAnd, Humanizer.WordForm wordForm);
Parameters​

number System.Int64

The number to convert.

addAnd System.Boolean

true to insert the locale-specific conjunction in compound numbers; otherwise, false.

wordForm WordForm

The grammatical or morphological word form to use.

Returns​

System.String
The localized words for number.

INumberToWordsConverter.Convert(long, GrammaticalGender, bool) Method​

Converts the number using the specified grammatical gender.

string Convert(long number, Humanizer.GrammaticalGender gender, bool addAnd=true);
Parameters​

number System.Int64

The number to convert.

gender GrammaticalGender

The grammatical gender to use when the locale distinguishes gendered forms.

addAnd System.Boolean

true to insert the locale-specific conjunction in compound numbers; otherwise, false.

Returns​

System.String
The localized words for number.

INumberToWordsConverter.Convert(long, WordForm) Method​

Converts the number using the locale's default grammatical gender and the specified word form.

string Convert(long number, Humanizer.WordForm wordForm);
Parameters​

number System.Int64

The number to convert.

wordForm WordForm

The grammatical or morphological word form to use.

Returns​

System.String
The localized words for number.

INumberToWordsConverter.Convert(long, WordForm, GrammaticalGender, bool) Method​

Converts the number using the specified grammatical gender and word form.

string Convert(long number, Humanizer.WordForm wordForm, Humanizer.GrammaticalGender gender, bool addAnd=true);
Parameters​

number System.Int64

The number to convert.

wordForm WordForm

The grammatical or morphological word form to use.

gender GrammaticalGender

The grammatical gender to use when the locale distinguishes gendered forms.

addAnd System.Boolean

true to insert the locale-specific conjunction in compound numbers; otherwise, false.

Returns​

System.String
The localized words for number.

INumberToWordsConverter.ConvertToOrdinal(int) Method​

Converts the number to an ordinal string using the locale's default grammatical gender.

string ConvertToOrdinal(int number);
Parameters​

number System.Int32

The number to convert.

Returns​

System.String
The localized ordinal words for number.

INumberToWordsConverter.ConvertToOrdinal(int, GrammaticalGender) Method​

Converts the number to an ordinal string using the specified grammatical gender.

string ConvertToOrdinal(int number, Humanizer.GrammaticalGender gender);
Parameters​

number System.Int32

The number to convert.

gender GrammaticalGender

The grammatical gender to use when the locale distinguishes gendered forms.

Returns​

System.String
The localized ordinal words for number.

INumberToWordsConverter.ConvertToOrdinal(int, GrammaticalGender, WordForm) Method​

Converts the number to an ordinal string using the specified grammatical gender and word form.

string ConvertToOrdinal(int number, Humanizer.GrammaticalGender gender, Humanizer.WordForm wordForm);
Parameters​

number System.Int32

The number to convert.

gender GrammaticalGender

The grammatical gender to use when the locale distinguishes gendered forms.

wordForm WordForm

The grammatical or morphological word form to use.

Returns​

System.String
The localized ordinal words for number.

INumberToWordsConverter.ConvertToOrdinal(int, WordForm) Method​

Converts the number to an ordinal string using the locale's default grammatical gender and the specified word form.

string ConvertToOrdinal(int number, Humanizer.WordForm wordForm);
Parameters​

number System.Int32

The number to convert.

wordForm WordForm

The grammatical or morphological word form to use.

Returns​

System.String
The localized ordinal words for number.

INumberToWordsConverter.ConvertToTuple(int) Method​

Converts the integer to a locale-specific named tuple such as single or double.

string ConvertToTuple(int number);
Parameters​

number System.Int32

The number to convert.

Returns​

System.String
The localized tuple name for number when the locale defines one; otherwise, a numeric fallback.