Skip to main content
Version: 3.0.1

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
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.
DefaultFormatterDefault implementation of IFormatter interface.
DefaultTimeOnlyHumanizeStrategyThe default 'distance of time' -> words calculator.
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
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()).
NumberToWordsExtensionTransform a number into words; e.g. 1 => one
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
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
ResourceKeys
ResourceKeys.DateHumanizeEncapsulates the logic required to get the resource keys for DateTime.Humanize
ResourceKeys.TimeSpanHumanizeEncapsulates the logic required to get the resource keys for TimeSpan.Humanize Examples: TimeSpanHumanize_SingleMinute, TimeSpanHumanize_MultipleHours.
ResourceKeys.TimeUnitSymbolEncapsulates the logic required to get the resource keys for TimeUnit.ToSymbol
ResourcesProvides access to the resources of Humanizer
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
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 exceptions to simple pluralization/singularization rules. Vocabularies.Default contains an extensive list of rules for US English. At this time, multiple vocabularies and removing existing rules are not supported.
WordsToNumberExtensionTransform humanized string to number; e.g. one => 1
Structs
ByteSize
Interfaces
ICollectionFormatterAn interface you should implement to localize Humanize for collections
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
IDateOnlyToOrdinalWordConverterThe interface used to localise the ToOrdinalWords method.
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
IDateToOrdinalWordConverterThe interface used to localise the ToOrdinalWords method.
IFormatterImplement this interface if your language has complex rules around dealing with numbers. For example in Romanian "5 days" is "5 zile", while "24 days" is "24 de zile" and in Arabic 2 days is يومين not 2 يوم
INumberToWordsConverterAn interface you should implement to localise ToWords and ToOrdinalWords methods
IOrdinalizerThe interface used to localise the Ordinalize method
IStringTransformerCan transform a string
ITimeOnlyHumanizeStrategyImplement this interface to create a new strategy for TimeOnly.Humanize and hook it in the Configurator.TimeOnlyHumanizeStrategy
ITimeOnlyToClockNotationConverterThe interface used to localise the ToClockNotation method.
ITruncatorCan truncate a string.
IWordsToNumberConverter
Enums
ClockNotationRoundingOptions for specifying readable clock notation
DataUnit
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
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.
TenseEnumerates the possible time references; past or future.
TimeUnit
TruncateFromTruncation location for humanizer
WordFormOptions for specifying the form of the word when different variations of the same word exists.