Skip to main content
Version: 4.0 (next)

Humanizer

Humanizer Namespace

Classes
ByteRateClass to hold a ByteSize and a measurement interval, for the purpose of calculating the rate of transfer
ByteSizeExtensionsProvides extension methods for ByteSize
CasingExtensionsApplyCase method to allow changing the case of a sentence easily
ChineseFinancialNumeralExtensionsContains extension methods for converting integers to Chinese financial characters.
CollectionHumanizeExtensionsHumanizes an IEnumerable into a human readable list
ConfiguratorProvides a configuration point for Humanizer
DateHumanizeExtensionsHumanizes DateTime into human readable sentence
DateToOrdinalWordsExtensionsHumanizes DateTime into human readable sentence
DefaultDateOnlyHumanizeStrategyThe default 'distance of time' -> words calculator.
DefaultDateTimeHumanizeStrategyThe default 'distance of time' -> words calculator.
DefaultDateTimeOffsetHumanizeStrategyThe default 'distance of time' -> words calculator.
DefaultFormatterProvides the standard formatter implementation for Humanizer locales.
DefaultTimeOnlyHumanizeStrategyThe default 'distance of time' -> words calculator.
DefaultTimeSpanHumanizeStrategyThe default strategy for converting System.TimeSpan values into human-readable text.
DynamicNumberOfCharactersAndPreserveWordsTruncatorTruncate a string to a fixed number of letters or digits, preserving whole words by never cutting a word in half. If a complete word (plus the delimiter, if any) cannot fit, then only the delimiter is returned. When truncating from the left, the delimiter is prepended if a complete word can be preserved; otherwise, only the delimiter is returned. The allowed count is computed by counting only letters/digits.
EnglishArticleContains methods for removing, appending and prepending article prefixes for sorting strings ignoring the article.
EnumDehumanizeExtensionsContains extension methods for dehumanizing Enum string values.
EnumHumanizeExtensionsContains extension methods for humanizing Enums
FractionalizeExtensionsContains extension methods for converting decimals to common fractions.
HeadingExtensionsContains extensions to transform a number indicating a heading into the textual representation of the heading.
In
In.Eight
In.Five
In.Four
In.Nine
In.One
In.Seven
In.Six
In.Ten
In.Three
In.Two
InDate
InDate.Eight
InDate.Five
InDate.Four
InDate.Nine
InDate.One
InDate.Seven
InDate.Six
InDate.Ten
InDate.Three
InDate.Two
InflectorExtensions
LocaliserRegistry<TLocaliser>A registry of localised system components with their associated locales
MetricNumeralExtensionsContains extension methods for changing a number to Metric representation (ToMetric) and from Metric representation back to the number (FromMetric)
NoMatchFoundExceptionThis is thrown on String.DehumanizeTo enum when the provided string cannot be mapped to the target enum
NumberToNumberExtensionsNumber to Number extensions
NumberToTimeSpanExtensionsProvides extension methods for converting numeric values to System.TimeSpan instances, enabling fluent and readable time duration creation (e.g., 5.Seconds(), 3.Hours(), 2.Weeks()).
NumberToWordsExtensionConverts numbers to localized words and ordinals. The output is culture-aware, including locale-specific high-range scale names and English-family differences such as en, en-GB, and en-IN.
On
On.AprilProvides fluent date accessors for April
On.AugustProvides fluent date accessors for August
On.DecemberProvides fluent date accessors for December
On.FebruaryProvides fluent date accessors for February
On.JanuaryProvides fluent date accessors for January
On.JulyProvides fluent date accessors for July
On.JuneProvides fluent date accessors for June
On.MarchProvides fluent date accessors for March
On.MayProvides fluent date accessors for May
On.NovemberProvides fluent date accessors for November
On.OctoberProvides fluent date accessors for October
On.SeptemberProvides fluent date accessors for September
OnDate
OnDate.AprilProvides fluent date accessors for April
OnDate.AugustProvides fluent date accessors for August
OnDate.DecemberProvides fluent date accessors for December
OnDate.FebruaryProvides fluent date accessors for February
OnDate.JanuaryProvides fluent date accessors for January
OnDate.JulyProvides fluent date accessors for July
OnDate.JuneProvides fluent date accessors for June
OnDate.MarchProvides fluent date accessors for March
OnDate.MayProvides fluent date accessors for May
OnDate.NovemberProvides fluent date accessors for November
OnDate.OctoberProvides fluent date accessors for October
OnDate.SeptemberProvides fluent date accessors for September
OrdinalizeExtensionsOrdinalize extensions
PluralizationFormsProvides authored singular and plural forms of one noun.
PrecisionDateOnlyHumanizeStrategyPrecision-based calculator for distance between two times
PrecisionDateTimeHumanizeStrategyPrecision-based calculator for distance between two times
PrecisionDateTimeOffsetHumanizeStrategyPrecision-based calculator for distance between two times
PrecisionTimeOnlyHumanizeStrategyPrecision-based calculator for distance between two times
PrepositionsExtensionsSystem.DateTime extensions related to spatial or temporal relations
RomanNumeralExtensionsContains extension methods for changing a number to Roman representation (ToRoman) and from Roman representation back to the number (FromRoman)
StringDehumanizeExtensionsContains extension methods for dehumanizing strings.
StringHumanizeExtensionsContains extension methods for humanizing string values.
TimeOnlyToClockNotationExtensionsHumanizes TimeOnly into human readable sentence
TimeSpanDehumanizeExtensionsContains extension methods for parsing invariant duration text into a System.TimeSpan.
TimeSpanHumanizeExtensionsHumanizes TimeSpan into human readable form
TimeUnitToSymbolExtensionsTransform a time unit into a symbol; e.g. Year => "a"
ToA portal to string transformation using IStringTransformer
ToQuantityExtensionsProvides extensions for formatting a System.String word as a quantity.
TruncateExtensionsAllow strings to be truncated
TruncatorGets a ITruncator
TupleizeExtensionsConvert int to named tuple strings (1 -> 'single', 2-> 'double' etc.). Only values 1-10, 100, and 1000 have specific names. All others will return 'n-tuple'.
VocabulariesContainer for registered vocabularies. At present, only a single vocabulary is supported: Default.
VocabularyA container for custom acronym casing and exceptions to simple pluralization/singularization rules. Vocabularies.Default contains an extensive list of rules for US English and supports process-wide acronym registration. At this time, multiple vocabularies and removing existing rules are not supported.
WordsToDecimalNumberExtensionConverts localized decimal number words into System.Decimal values.
WordsToNumberExtensionConverts localized number words back into numeric values. Parsing is culture-aware, honors locale inheritance, and supports the same natural high-range forms that the locale authoring data exposes through number.words and number.parse.
Structs
ByteSize
Interfaces
ICollectionFormatterFormats collections into localized, human-readable lists.
ICulturedStringTransformerCan transform a string with the given culture
IDateOnlyHumanizeStrategyImplement this interface to create a new strategy for DateOnly.Humanize and hook it in the Configurator.DateOnlyHumanizeStrategy
IDateOnlyToOrdinalWordConverterConverts dates into the localized text used by ToOrdinalWords.
IDateTimeHumanizeStrategyImplement this interface to create a new strategy for DateTime.Humanize and hook it in the Configurator.DateTimeHumanizeStrategy
IDateTimeOffsetHumanizeStrategyImplement this interface to create a new strategy for DateTime.Humanize and hook it in the Configurator.DateTimeOffsetHumanizeStrategy
IDateToOrdinalWordConverterConverts dates into the localized text used by ToOrdinalWords.
IFormatterLocalizes Humanizer's number, date, duration, and unit formatting.
IFractionalTimeSpanFormatterExtends a formatter with support for fractional-second duration values.
IFractionalTimeSpanHumanizeStrategyExtends a time-span humanization strategy with fractional-second support.
IGrammaticalCaseTimeSpanFormatterOptionally extends a locale formatter with grammatical-case-aware duration phrases.
IGrammaticalCaseTimeSpanHumanizeStrategyOptionally extends a time-span humanization strategy with grammatical-case support. Existing ITimeSpanHumanizeStrategy implementations remain valid for existing duration APIs but cannot service HumanizeWithCase.
ILongOrdinalizerLocalizes the ordinal form of a 64-bit integer.
INumberToWordsConverterConverts numbers into locale-specific words, ordinals, and tuple names.
IOrdinalizerLocalizes the ordinal form of a number.
IStringTransformerCan transform a string
ITimeOnlyHumanizeStrategyImplement this interface to create a new strategy for TimeOnly.Humanize and hook it in the Configurator.TimeOnlyHumanizeStrategy
ITimeOnlyToClockNotationConverterConverts times into the localized text used by ToClockNotation.
ITimeSpanHumanizeStrategyDefines a strategy for converting System.TimeSpan values into human-readable text.
ITruncatorCan truncate a string.
IWordsToDecimalNumberConverterConverts localized decimal number words into System.Decimal values.
IWordsToNumberConverterConverts localized number words into numeric values.
Enums
ByteSizeUnitSystemSelects the unit system used by explicit ByteSize parsing and formatting APIs.
ClockNotationRoundingOptions for specifying readable clock notation
DataUnitRepresents the data units supported by Humanizer's data-size formatting.
EnumHumanizeSourceSpecifies the source used to humanize an enum value.
GrammaticalCaseOptions for specifying the desired grammatical case for the output words
GrammaticalGenderOptions for specifying the desired grammatical gender for the output words
HeadingStyleStyle for the cardinal direction humanization
IndianScaleStyleSelects the large-number vocabulary used by ToIndianWords(this long, IndianScaleStyle).
LetterCasingOptions for specifying the desired letter casing for the output string
MetricNumeralFormatsFlags for formatting the metric representation of numerals.
OnNoMatchDictating what should be done when a match is not found - currently used only for DehumanizeTo
PluralityProvides hint for Humanizer as to whether a word is singular, plural or with unknown plurality
ShowQuantityAsEnumerates the ways of displaying a quantity value when converting a word to a quantity string.
TenseIndicates whether a relative time reference is in the past or the future.
TimeUnitRepresents the time units supported by Humanizer's relative-time and duration formatters.
TruncateFromTruncation location for humanizer
WordFormOptions for specifying the form of the word when different variations of the same word exists.