Skip to main content
Version: 4.0 (next)

Humanizer.OrdinalizeExtensions

OrdinalizeExtensions Class​

Ordinalize extensions

public static class OrdinalizeExtensions

Inheritance System.Object → OrdinalizeExtensions

Remarks​

Ordinalization accepts integral values only. Callers with fractional values must choose and apply an explicit rounding and conversion policy before ordinalizing.

Methods​

OrdinalizeExtensions.Ordinalize(this int) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

public static string Ordinalize(this int number);
Parameters​

number System.Int32

The number to be ordinalized

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this int, GrammaticalGender) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th. Gender for Brazilian Portuguese locale 1.Ordinalize(GrammaticalGender.Masculine) -> "1º" 1.Ordinalize(GrammaticalGender.Feminine) -> "1ª"

public static string Ordinalize(this int number, Humanizer.GrammaticalGender gender);
Parameters​

number System.Int32

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this int, GrammaticalGender, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations using the grammatical gender provided

public static string Ordinalize(this int number, Humanizer.GrammaticalGender gender, Humanizer.WordForm wordForm);
Parameters​

number System.Int32

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

1.Ordinalize(GrammaticalGender.Masculine, WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
1.Ordinalize(GrammaticalGender.Masculine, WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"
1.Ordinalize(GrammaticalGender.Feminine, WordForm.Normal) -> 1.ª // As in "Es 1ª vez que hago esto"

OrdinalizeExtensions.Ordinalize(this int, GrammaticalGender, CultureInfo) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th. Gender for Brazilian Portuguese locale 1.Ordinalize(GrammaticalGender.Masculine) -> "1º" 1.Ordinalize(GrammaticalGender.Feminine) -> "1ª"

public static string Ordinalize(this int number, Humanizer.GrammaticalGender gender, System.Globalization.CultureInfo? culture);
Parameters​

number System.Int32

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this int, GrammaticalGender, CultureInfo, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations using the grammatical gender provided

public static string Ordinalize(this int number, Humanizer.GrammaticalGender gender, System.Globalization.CultureInfo? culture, Humanizer.WordForm wordForm);
Parameters​

number System.Int32

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

1.Ordinalize(GrammaticalGender.Masculine, new CultureInfo("es-ES"),WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
1.Ordinalize(GrammaticalGender.Masculine, new CultureInfo("es-ES"), WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"
1.Ordinalize(GrammaticalGender.Feminine, new CultureInfo("es-ES"), WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"

OrdinalizeExtensions.Ordinalize(this int, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations.

public static string Ordinalize(this int number, Humanizer.WordForm wordForm);
Parameters​

number System.Int32

The number to be ordinalized

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

1.Ordinalize(WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
1.Ordinalize(WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"

OrdinalizeExtensions.Ordinalize(this int, CultureInfo) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

public static string Ordinalize(this int number, System.Globalization.CultureInfo? culture);
Parameters​

number System.Int32

The number to be ordinalized

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this int, CultureInfo, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations.

public static string Ordinalize(this int number, System.Globalization.CultureInfo? culture, Humanizer.WordForm wordForm);
Parameters​

number System.Int32

The number to be ordinalized

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

1.Ordinalize(new CultureInfo("es-ES"),WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
1.Ordinalize(new CultureInfo("es-ES"), WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"

OrdinalizeExtensions.Ordinalize(this long) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

public static string Ordinalize(this long number);
Parameters​

number System.Int64

The number to be ordinalized

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this long, GrammaticalGender) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence using the provided grammatical gender.

public static string Ordinalize(this long number, Humanizer.GrammaticalGender gender);
Parameters​

number System.Int64

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this long, GrammaticalGender, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations using the grammatical gender provided.

public static string Ordinalize(this long number, Humanizer.GrammaticalGender gender, Humanizer.WordForm wordForm);
Parameters​

number System.Int64

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

OrdinalizeExtensions.Ordinalize(this long, GrammaticalGender, CultureInfo) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence using the provided grammatical gender.

public static string Ordinalize(this long number, Humanizer.GrammaticalGender gender, System.Globalization.CultureInfo? culture);
Parameters​

number System.Int64

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this long, GrammaticalGender, CultureInfo, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations using the grammatical gender provided.

public static string Ordinalize(this long number, Humanizer.GrammaticalGender gender, System.Globalization.CultureInfo? culture, Humanizer.WordForm wordForm);
Parameters​

number System.Int64

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

OrdinalizeExtensions.Ordinalize(this long, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations.

public static string Ordinalize(this long number, Humanizer.WordForm wordForm);
Parameters​

number System.Int64

The number to be ordinalized

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

OrdinalizeExtensions.Ordinalize(this long, CultureInfo) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

public static string Ordinalize(this long number, System.Globalization.CultureInfo? culture);
Parameters​

number System.Int64

The number to be ordinalized

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this long, CultureInfo, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations.

public static string Ordinalize(this long number, System.Globalization.CultureInfo? culture, Humanizer.WordForm wordForm);
Parameters​

number System.Int64

The number to be ordinalized

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

OrdinalizeExtensions.Ordinalize(this string) Method​

Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

public static string Ordinalize(this string numberString);
Parameters​

numberString System.String

The number, in string, to be ordinalized

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this string, GrammaticalGender) Method​

Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th. Gender for Brazilian Portuguese locale "1".Ordinalize(GrammaticalGender.Masculine) -> "1º" "1".Ordinalize(GrammaticalGender.Feminine) -> "1ª"

public static string Ordinalize(this string numberString, Humanizer.GrammaticalGender gender);
Parameters​

numberString System.String

The number, in string, to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this string, GrammaticalGender, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations using the grammatical gender provided

public static string Ordinalize(this string numberString, Humanizer.GrammaticalGender gender, Humanizer.WordForm wordForm);
Parameters​

numberString System.String

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

"1".Ordinalize(GrammaticalGender.Masculine, WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
"1".Ordinalize(GrammaticalGender.Masculine, WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"
"1".Ordinalize(GrammaticalGender.Feminine, WordForm.Normal) -> 1.ª // As in "Es 1ª vez que hago esto"

OrdinalizeExtensions.Ordinalize(this string, GrammaticalGender, CultureInfo) Method​

Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th. Gender for Brazilian Portuguese locale "1".Ordinalize(GrammaticalGender.Masculine) -> "1º" "1".Ordinalize(GrammaticalGender.Feminine) -> "1ª"

public static string Ordinalize(this string numberString, Humanizer.GrammaticalGender gender, System.Globalization.CultureInfo? culture);
Parameters​

numberString System.String

The number, in string, to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this string, GrammaticalGender, CultureInfo, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations using the grammatical gender provided

public static string Ordinalize(this string numberString, Humanizer.GrammaticalGender gender, System.Globalization.CultureInfo? culture, Humanizer.WordForm wordForm);
Parameters​

numberString System.String

The number to be ordinalized

gender GrammaticalGender

The grammatical gender to use for output words

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

"1".Ordinalize(GrammaticalGender.Masculine, new CultureInfo("es-ES"),WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
"1".Ordinalize(GrammaticalGender.Masculine, new CultureInfo("es-ES"), WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"
"1".Ordinalize(GrammaticalGender.Feminine, new CultureInfo("es-ES"), WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"

OrdinalizeExtensions.Ordinalize(this string, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations.

public static string Ordinalize(this string numberString, Humanizer.WordForm wordForm);
Parameters​

numberString System.String

The number, in string, to be ordinalized

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

"1".Ordinalize(WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
"1".Ordinalize(WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"

OrdinalizeExtensions.Ordinalize(this string, CultureInfo) Method​

Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

public static string Ordinalize(this string numberString, System.Globalization.CultureInfo? culture);
Parameters​

numberString System.String

The number, in string, to be ordinalized

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String

OrdinalizeExtensions.Ordinalize(this string, CultureInfo, WordForm) Method​

Turns a number into an ordinal number used to denote the position in an ordered sequence supporting specific locale's variations.

public static string Ordinalize(this string numberString, System.Globalization.CultureInfo? culture, Humanizer.WordForm wordForm);
Parameters​

numberString System.String

The number to be ordinalized

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

wordForm WordForm

Form of the word, i.e. abbreviation

Returns​

System.String
The number ordinalized

Example​

In Spanish:

"1".Ordinalize(new CultureInfo("es-ES"),WordForm.Abbreviation) -> 1.er // As in "Vivo en el 1.er piso"
"1".Ordinalize(new CultureInfo("es-ES"), WordForm.Normal) -> 1.º // As in "Fui el 1º de mi promoción"