{"id":13662588,"url":"https://github.com/Thundernerd/Unity3D-Humanizr","last_synced_at":"2025-04-25T10:32:33.727Z","repository":{"id":37785580,"uuid":"278914800","full_name":"Thundernerd/Unity3D-Humanizr","owner":"Thundernerd","description":"Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities.","archived":false,"fork":false,"pushed_at":"2024-04-08T08:39:32.000Z","size":240,"stargazers_count":35,"open_issues_count":6,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T17:09:31.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thundernerd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-11T17:58:03.000Z","updated_at":"2024-05-05T21:31:08.000Z","dependencies_parsed_at":"2022-08-18T07:55:39.384Z","dependency_job_id":null,"html_url":"https://github.com/Thundernerd/Unity3D-Humanizr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thundernerd%2FUnity3D-Humanizr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thundernerd%2FUnity3D-Humanizr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thundernerd%2FUnity3D-Humanizr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thundernerd%2FUnity3D-Humanizr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thundernerd","download_url":"https://codeload.github.com/Thundernerd/Unity3D-Humanizr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223996817,"owners_count":17238375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:02:02.855Z","updated_at":"2024-11-10T18:30:56.626Z","avatar_url":"https://github.com/Thundernerd.png","language":"C#","readme":"\u003cp\u003e\u003cimg src=\"https://raw.github.com/Humanizr/Humanizer/master/logo.png\" alt=\"Logo\" style=\"max-width:100%;\" /\u003e\u003c/p\u003e\n\n[\u003cimg align=\"right\" width=\"100px\" src=\"https://dotnetfoundation.org/img/logo_big.svg\" /\u003e](https://dotnetfoundation.org/projects?type=project\u0026q=humanizer)\n\nHumanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities. It is part of the [.NET Foundation](https://www.dotnetfoundation.org/), and operates under their [code of conduct](https://www.dotnetfoundation.org/code-of-conduct). It is licensed under the [MIT](https://opensource.org/licenses/MIT) (an OSI approved license).\n\n[![Join the chat at https://gitter.im/Humanizr/Humanizer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Humanizr/Humanizer)\n\n### Table of contents\n - [Installation](#installation)\n - [Features](#features)\n   - [Humanize String](#humanize-string)\n   - [Dehumanize String](#dehumanize-string)\n   - [Transform String](#transform-string)\n   - [Truncate String](#truncate-string)\n   - [Format String](#format-string)\n   - [Humanize Enums](#humanize-enums)\n   - [Dehumanize Enums](#dehumanize-enums)\n   - [Humanize DateTime](#humanize-datetime)\n   - [Humanize TimeSpan](#humanize-timespan)\n   - [Humanize Collections](#humanize-collections)\n   - [Inflector methods](#inflector-methods)\n     - [Pluralize](#pluralize)\n     - [Singularize](#singularize)\n     - [Adding Words](#adding-words)\n     - [ToQuantity](#toquantity)\n     - [Ordinalize](#ordinalize)\n     - [Titleize](#titleize)\n     - [Pascalize](#pascalize)\n     - [Camelize](#camelize)\n     - [Underscore](#underscore)\n     - [Dasherize \u0026 Hyphenate](#dasherize--hyphenate)\n\t - [Kebaberize](#kebaberize) \n   - [Fluent date](#fluent-date)\n   - [Number to Numbers](#number-to-numbers)\n   - [Number to words](#number-to-words)\n   - [Number to ordinal words](#number-to-ordinal-words)\n   - [DateTime to ordinal words](#date-time-to-ordinal-words)\n   - [Roman numerals](#roman-numerals)\n   - [Metric numerals](#metric-numerals)\n   - [ByteSize](#bytesize)\n   - [Heading to words](#heading-to-words)\n   - [Tupleize](#tupleize)\n - [How to contribute?](#how-to-contribute)\n - [Main contributors](#main-contributors)\n - [License](#license)\n - [Icon](#icon)\n - [Support](#support)\n  \n## \u003ca id=\"installation\"\u003eInstallation\u003c/a\u003e\n1. The package is available on the [openupm registry](https://openupm.com). You can install it via [openupm-cli](https://github.com/openupm/openupm-cli).\n```\nopenupm add net.tnrd.humanizr\n```\n2. You can also install via git url by adding these entries in your **manifest.json**\n```json\n\"net.tnrd.humanizr\": \"https://github.com/Thundernerd/Unity3D-Humanizr.git\",\n\"com.unity.nuget.newtonsoft-json\": \"2.0.0\"\n```\n\n## \u003ca id=\"features\"\u003eFeatures\u003c/a\u003e\n\n### \u003ca id=\"humanize-string\"\u003eHumanize String\u003c/a\u003e\n`Humanize` string extensions allow you turn an otherwise computerized string into a more readable human-friendly one.\nThe foundation of this was set in the [BDDfy framework](https://github.com/TestStack/TestStack.BDDfy) where class names, method names and properties are turned into human readable sentences.\n\n```C#\n\"PascalCaseInputStringIsTurnedIntoSentence\".Humanize() =\u003e \"Pascal case input string is turned into sentence\"\n\n\"Underscored_input_string_is_turned_into_sentence\".Humanize() =\u003e \"Underscored input string is turned into sentence\"\n\n\"Underscored_input_String_is_turned_INTO_sentence\".Humanize() =\u003e \"Underscored input String is turned INTO sentence\"\n```\n\nNote that a string that contains only upper case letters, and consists only of one word, is always treated as an acronym (regardless of its length). To guarantee that any arbitrary string will always be humanized you must use a transform (see `Transform` method below):\n\n```C#\n// acronyms are left intact\n\"HTML\".Humanize() =\u003e \"HTML\"\n\n// any unbroken upper case string is treated as an acronym\n\"HUMANIZER\".Humanize() =\u003e \"HUMANIZER\"\n\"HUMANIZER\".Transform(To.LowerCase, To.TitleCase) =\u003e \"Humanizer\"\n```\n\nYou may also specify the desired letter casing:\n\n```C#\n\"CanReturnTitleCase\".Humanize(LetterCasing.Title) =\u003e \"Can Return Title Case\"\n\n\"Can_return_title_Case\".Humanize(LetterCasing.Title) =\u003e \"Can Return Title Case\"\n\n\"CanReturnLowerCase\".Humanize(LetterCasing.LowerCase) =\u003e \"can return lower case\"\n\n\"CanHumanizeIntoUpperCase\".Humanize(LetterCasing.AllCaps) =\u003e \"CAN HUMANIZE INTO UPPER CASE\"\n```\n\n \u003e The `LetterCasing` API and the methods accepting it are legacy from V0.2 era and will be deprecated in the future. Instead of that, you can use `Transform` method explained below.\n\n### \u003ca id=\"dehumanize-string\"\u003eDehumanize String\u003c/a\u003e\nMuch like you can humanize a computer friendly into human friendly string you can dehumanize a human friendly string into a computer friendly one:\n\n```C#\n\"Pascal case input string is turned into sentence\".Dehumanize() =\u003e \"PascalCaseInputStringIsTurnedIntoSentence\"\n```\n\n### \u003ca id=\"transform-string\"\u003eTransform String\u003c/a\u003e\nThere is a `Transform` method that supersedes `LetterCasing`, `ApplyCase` and `Humanize` overloads that accept `LetterCasing`.\nTransform method signature is as follows:\n\n```C#\nstring Transform(this string input, params IStringTransformer[] transformers)\n```\n\nAnd there are some out of the box implementations of `IStringTransformer` for letter casing:\n\n```C#\n\"Sentence casing\".Transform(To.LowerCase) =\u003e \"sentence casing\"\n\"Sentence casing\".Transform(To.SentenceCase) =\u003e \"Sentence casing\"\n\"Sentence casing\".Transform(To.TitleCase) =\u003e \"Sentence Casing\"\n\"Sentence casing\".Transform(To.UpperCase) =\u003e \"SENTENCE CASING\"\n```\n\n`LowerCase` is a public static property on `To` class that returns an instance of private `ToLowerCase` class that implements `IStringTransformer` and knows how to turn a string into lower case.\n\nThe benefit of using `Transform` and `IStringTransformer` over `ApplyCase` and `LetterCasing` is that `LetterCasing` is an enum and you're limited to use what's in the framework\nwhile `IStringTransformer` is an interface you can implement in your codebase once and use it with `Transform` method allowing for easy extension.\n\n### \u003ca id=\"truncate-string\"\u003eTruncate String\u003c/a\u003e\nYou can truncate a `string` using the `Truncate` method:\n\n```c#\n\"Long text to truncate\".Truncate(10) =\u003e \"Long text…\"\n```\n\nBy default the `'…'` character is used to truncate strings. The advantage of using the `'…'` character instead of `\"...\"` is that the former only takes a single character and thus allows more text to be shown before truncation. If you want, you can also provide your own truncation string:\n\n```c#\n\"Long text to truncate\".Truncate(10, \"---\") =\u003e \"Long te---\"\n```\n\nThe default truncation strategy, `Truncator.FixedLength`, is to truncate the input string to a specific length, including the truncation string length.\nThere are two more truncator strategies available: one for a fixed number of (alpha-numerical) characters and one for a fixed number of words.\nTo use a specific truncator when truncating, the two `Truncate` methods shown in the previous examples all have an overload that allow you to specify the `ITruncator` instance to use for the truncation.\nHere are examples on how to use the three provided truncators:\n\n```c#\n\"Long text to truncate\".Truncate(10, Truncator.FixedLength) =\u003e \"Long text…\"\n\"Long text to truncate\".Truncate(10, \"---\", Truncator.FixedLength) =\u003e \"Long te---\"\n\n\"Long text to truncate\".Truncate(6, Truncator.FixedNumberOfCharacters) =\u003e \"Long t…\"\n\"Long text to truncate\".Truncate(6, \"---\", Truncator.FixedNumberOfCharacters) =\u003e \"Lon---\"\n\n\"Long text to truncate\".Truncate(2, Truncator.FixedNumberOfWords) =\u003e \"Long text…\"\n\"Long text to truncate\".Truncate(2, \"---\", Truncator.FixedNumberOfWords) =\u003e \"Long text---\"\n```\n\nNote that you can also use create your own truncator by implementing the `ITruncator` interface.\n\nThere is also an option to choose whether to truncate the string from the beginning (`TruncateFrom.Left`) or the end (`TruncateFrom.Right`).\nDefault is the right as shown in the examples above. The examples below show how to truncate from the beginning of the string:\n\n```c#\n\"Long text to truncate\".Truncate(10, Truncator.FixedLength, TruncateFrom.Left) =\u003e \"… truncate\"\n\"Long text to truncate\".Truncate(10, \"---\", Truncator.FixedLength, TruncateFrom.Left) =\u003e \"---runcate\"\n\n\"Long text to truncate\".Truncate(10, Truncator.FixedNumberOfCharacters, TruncateFrom.Left) =\u003e \"…o truncate\"\n\"Long text to truncate\".Truncate(16, \"---\", Truncator.FixedNumberOfCharacters, TruncateFrom.Left) =\u003e \"---ext to truncate\"\n\n\"Long text to truncate\".Truncate(2, Truncator.FixedNumberOfWords, TruncateFrom.Left) =\u003e \"…to truncate\"\n\"Long text to truncate\".Truncate(2, \"---\", Truncator.FixedNumberOfWords, TruncateFrom.Left) =\u003e \"---to truncate\"\n```\n\n### \u003ca id=\"format-string\"\u003eFormat String\u003c/a\u003e\nYou can format a `string` using the `FormatWith()` method:\n\n```c#\n\"To be formatted -\u003e {0}/{1}.\".FormatWith(1, \"A\") =\u003e \"To be formatted -\u003e 1/A.\"\n```\n\nThis is an extension method based on `String.Format`, so exact rules applies to it.\nIf `format` is null, it'll throw `ArgumentNullException`.\nIf passed a fewer number for arguments, it'll throw `String.FormatException` exception.\n\nYou also can specify the culture to use explicitly as the first parameter for the `FormatWith()` method:\n\n```c#\n\"{0:N2}\".FormatWith(new CultureInfo(\"ru-RU\"), 6666.66) =\u003e \"6 666,66\"\n```\n\nIf a culture is not specified, current thread's current culture is used.\n\n### \u003ca id=\"humanize-enums\"\u003eHumanize Enums\u003c/a\u003e\nCalling `ToString` directly on enum members usually results in less than ideal output for users. The solution to this is usually to use `DescriptionAttribute` data annotation and then read that at runtime to get a more friendly output. That is a great solution; but more often than not we only need to put some space between words of an enum member - which is what `String.Humanize()` does well. For an enum like:\n\n```C#\npublic enum EnumUnderTest\n{\n    [Description(\"Custom description\")]\n    MemberWithDescriptionAttribute,\n    MemberWithoutDescriptionAttribute,\n    ALLCAPITALS\n}\n```\n\nYou will get:\n\n```C#\n// DescriptionAttribute is honored\nEnumUnderTest.MemberWithDescriptionAttribute.Humanize() =\u003e \"Custom description\"\n\n// In the absence of Description attribute string.Humanizer kicks in\nEnumUnderTest.MemberWithoutDescriptionAttribute.Humanize() =\u003e \"Member without description attribute\"\n\n// Of course you can still apply letter casing\nEnumUnderTest.MemberWithoutDescriptionAttribute.Humanize().Transform(To.TitleCase) =\u003e \"Member Without Description Attribute\"\n```\n\nYou are not limited to `DescriptionAttribute` for custom description. Any attribute applied on enum members with a `string Description` property counts.\nThis is to help with platforms with missing `DescriptionAttribute` and also for allowing subclasses of the `DescriptionAttribute`.\n\nYou can even configure the name of the property of attibute to use as description.\n\n`Configurator.EnumDescriptionPropertyLocator = p =\u003e p.Name == \"Info\"`\n\nIf you need to provide localised descriptions you can use `DisplayAttribute` data annotation instead.\n\n```C#\npublic enum EnumUnderTest\n{\n    [Display(Description = \"EnumUnderTest_Member\", ResourceType = typeof(Project.Resources))]\n    Member\n}\n```\n\nYou will get:\n\n```C#\nEnumUnderTest.Member.Humanize() =\u003e \"content\" // from Project.Resources found under \"EnumUnderTest_Member\" resource key\n```\n\nHopefully this will help avoid littering enums with unnecessary attributes!\n\n### \u003ca id=\"dehumanize-enums\"\u003eDehumanize Enums\u003c/a\u003e\nDehumanizes a string into the Enum it was originally Humanized from! The API looks like:\n\n```C#\npublic static TTargetEnum DehumanizeTo\u003cTTargetEnum\u003e(this string input)\n```\n\nAnd the usage is:\n\n```C#\n\"Member without description attribute\".DehumanizeTo\u003cEnumUnderTest\u003e() =\u003e EnumUnderTest.MemberWithoutDescriptionAttribute\n```\n\nAnd just like the Humanize API it honors the `Description` attribute. You don't have to provide the casing you provided during humanization: it figures it out.\n\nThere is also a non-generic counterpart for when the original Enum is not known at compile time:\n\n```C#\npublic static Enum DehumanizeTo(this string input, Type targetEnum, NoMatch onNoMatch = NoMatch.ThrowsException)\n```\n\nwhich can be used like:\n\n```C#\n\"Member without description attribute\".DehumanizeTo(typeof(EnumUnderTest)) =\u003e EnumUnderTest.MemberWithoutDescriptionAttribute\n```\n\nBy default both methods throw a `NoMatchFoundException` when they cannot match the provided input against the target enum.\nIn the non-generic method you can also ask the method to return null by setting the second optional parameter to `NoMatch.ReturnsNull`.\n\n### \u003ca id=\"humanize-datetime\"\u003eHumanize DateTime\u003c/a\u003e\nYou can `Humanize` an instance of `DateTime` or `DateTimeOffset` and get back a string telling how far back or forward in time that is:\n\n```C#\nDateTime.UtcNow.AddHours(-30).Humanize() =\u003e \"yesterday\"\nDateTime.UtcNow.AddHours(-2).Humanize() =\u003e \"2 hours ago\"\n\nDateTime.UtcNow.AddHours(30).Humanize() =\u003e \"tomorrow\"\nDateTime.UtcNow.AddHours(2).Humanize() =\u003e \"2 hours from now\"\n\nDateTimeOffset.UtcNow.AddHours(1).Humanize() =\u003e \"an hour from now\"\n```\n\nHumanizer supports both local and UTC dates as well as dates with offset (`DateTimeOffset`). You could also provide the date you want the input date to be compared against. If null, it will use the current date as comparison base.\nAlso, culture to use can be specified explicitly. If it is not, current thread's current UI culture is used.\nHere is the API signature:\n\n```C#\npublic static string Humanize(this DateTime input, bool utcDate = true, DateTime? dateToCompareAgainst = null, CultureInfo culture = null)\npublic static string Humanize(this DateTimeOffset input, DateTimeOffset? dateToCompareAgainst = null, CultureInfo culture = null)\n```\n\nMany localizations are available for this method. Here is a few examples:\n\n```C#\n// In ar culture\nDateTime.UtcNow.AddDays(-1).Humanize() =\u003e \"أمس\"\nDateTime.UtcNow.AddDays(-2).Humanize() =\u003e \"منذ يومين\"\nDateTime.UtcNow.AddDays(-3).Humanize() =\u003e \"منذ 3 أيام\"\nDateTime.UtcNow.AddDays(-11).Humanize() =\u003e \"منذ 11 يوم\"\n\n// In ru-RU culture\nDateTime.UtcNow.AddMinutes(-1).Humanize() =\u003e \"минуту назад\"\nDateTime.UtcNow.AddMinutes(-2).Humanize() =\u003e \"2 минуты назад\"\nDateTime.UtcNow.AddMinutes(-10).Humanize() =\u003e \"10 минут назад\"\nDateTime.UtcNow.AddMinutes(-21).Humanize() =\u003e \"21 минуту назад\"\nDateTime.UtcNow.AddMinutes(-22).Humanize() =\u003e \"22 минуты назад\"\nDateTime.UtcNow.AddMinutes(-40).Humanize() =\u003e \"40 минут назад\"\n```\n\nThere are two strategies for `DateTime.Humanize`: the default one as seen above and a precision based one.\nTo use the precision based strategy you need to configure it:\n\n```C#\nConfigurator.DateTimeHumanizeStrategy = new PrecisionDateTimeHumanizeStrategy(precision: .75);\nConfigurator.DateTimeOffsetHumanizeStrategy = new PrecisionDateTimeOffsetHumanizeStrategy(precision: .75); // configure when humanizing DateTimeOffset\n```\n\nThe default precision is set to .75 but you can pass your desired precision too. With precision set to 0.75:\n\n```C#\n44 seconds =\u003e 44 seconds ago/from now\n45 seconds =\u003e one minute ago/from now\n104 seconds =\u003e one minute ago/from now\n105 seconds =\u003e two minutes ago/from now\n\n25 days =\u003e a month ago/from now\n```\n\n**No dehumanization for dates as `Humanize` is a lossy transformation and the human friendly date is not reversible**\n\n### \u003ca id=\"humanize-timespan\"\u003eHumanize TimeSpan\u003c/a\u003e\nYou can call `Humanize` on a `TimeSpan` to a get human friendly representation for it:\n\n```C#\nTimeSpan.FromMilliseconds(1).Humanize() =\u003e \"1 millisecond\"\nTimeSpan.FromMilliseconds(2).Humanize() =\u003e \"2 milliseconds\"\nTimeSpan.FromDays(1).Humanize() =\u003e \"1 day\"\nTimeSpan.FromDays(16).Humanize() =\u003e \"2 weeks\"\n```\n\nThere is an optional `precision` parameter for `TimeSpan.Humanize` which allows you to specify the precision of the returned value.\nThe default value of `precision` is 1 which means only the largest time unit is returned like you saw in `TimeSpan.FromDays(16).Humanize()`.\nHere is a few examples of specifying precision:\n\n```C#\nTimeSpan.FromDays(1).Humanize(precision:2) =\u003e \"1 day\" // no difference when there is only one unit in the provided TimeSpan\nTimeSpan.FromDays(16).Humanize(2) =\u003e \"2 weeks, 2 days\"\n\n// the same TimeSpan value with different precision returns different results\nTimeSpan.FromMilliseconds(1299630020).Humanize() =\u003e \"2 weeks\"\nTimeSpan.FromMilliseconds(1299630020).Humanize(3) =\u003e \"2 weeks, 1 day, 1 hour\"\nTimeSpan.FromMilliseconds(1299630020).Humanize(4) =\u003e \"2 weeks, 1 day, 1 hour, 30 seconds\"\nTimeSpan.FromMilliseconds(1299630020).Humanize(5) =\u003e \"2 weeks, 1 day, 1 hour, 30 seconds, 20 milliseconds\"\n```\n\nBy default when using `precision` parameter empty time units are not counted towards the precision of the returned value.\nIf this behavior isn't desired for you, you can use the overloaded `TimeSpan.Humanize` method with `countEmptyUnits` parameter. Leading empty time units never count.\nHere is an example showing the difference of counting empty units:\n\n```C#\nTimeSpan.FromMilliseconds(3603001).Humanize(3) =\u003e \"1 hour, 3 seconds, 1 millisecond\"\nTimeSpan.FromMilliseconds(3603001).Humanize(3, countEmptyUnits:true) =\u003e \"1 hour, 3 seconds\"\n```\n\nMany localizations are available for this method:\n\n```C#\n// in de-DE culture\nTimeSpan.FromDays(1).Humanize() =\u003e \"Ein Tag\"\nTimeSpan.FromDays(2).Humanize() =\u003e \"2 Tage\"\n\n// in sk-SK culture\nTimeSpan.FromMilliseconds(1).Humanize() =\u003e \"1 milisekunda\"\nTimeSpan.FromMilliseconds(2).Humanize() =\u003e \"2 milisekundy\"\nTimeSpan.FromMilliseconds(5).Humanize() =\u003e \"5 milisekúnd\"\n```\n\nCulture to use can be specified explicitly. If it is not, current thread's current UI culture is used. Example:\n\n```C#\nTimeSpan.FromDays(1).Humanize(culture: \"ru-RU\") =\u003e \"один день\"\n```\n\nIn addition, a minimum unit of time may be specified to avoid rolling down to a smaller unit. For example:\n  ```C#\n  TimeSpan.FromMilliseconds(122500).Humanize(minUnit: TimeUnit.Second) =\u003e \"2 minutes, 2 seconds\"    // instead of 2 minutes, 2 seconds, 500 milliseconds\n  TimeSpan.FromHours(25).Humanize(minUnit: TimeUnit.Day) =\u003e \"1 Day\"   //instead of 1 Day, 1 Hour\n  ```\n\nIn addition, a maximum unit of time may be specified to avoid rolling up to the next largest unit. For example:\n```C#\nTimeSpan.FromDays(7).Humanize(maxUnit: TimeUnit.Day) =\u003e \"7 days\"    // instead of 1 week\nTimeSpan.FromMilliseconds(2000).Humanize(maxUnit: TimeUnit.Millisecond) =\u003e \"2000 milliseconds\"    // instead of 2 seconds\n```\nThe default maxUnit is `TimeUnit.Week` because it gives exact results. You can increase this value to `TimeUnit.Month` or `TimeUnit.Year` which will give you an approximation based on 365.2425 days a year and 30.436875 days a month. Therefore the months are alternating between 30 and 31 days in length and every fourth year is 366 days long.\n```C#\nTimeSpan.FromDays(486).Humanize(maxUnit: TimeUnit.Year, precision: 7) =\u003e \"1 year, 3 months, 29 days\" // One day further is 1 year, 4 month\nTimeSpan.FromDays(517).Humanize(maxUnit: TimeUnit.Year, precision: 7) =\u003e \"1 year, 4 months, 30 days\" // This month has 30 days and one day further is 1 year, 5 months\n```\n\nWhen there are multiple time units, they are combined using the `\", \"` string: \n\n```C#\nTimeSpan.FromMilliseconds(1299630020).Humanize(3) =\u003e \"2 weeks, 1 day, 1 hour\"\n```\n\nWhen `TimeSpan` is zero, the default behavior will return \"0\" plus whatever the minimum time unit is. However, if you assign `true` to `toWords` when calling `Humanize`, then the method returns \"no time\". For example:\n```C#\nTimeSpan.Zero.Humanize(1) =\u003e \"0 milliseconds\"\nTimeSpan.Zero.Humanize(1, toWords: true) =\u003e \"no time\"\nTimeSpan.Zero.Humanize(1, minUnit: Humanizer.Localisation.TimeUnit.Second) =\u003e \"0 seconds\"\n```\n\nUsing the `collectionSeparator` parameter, you can specify your own separator string:\n\n```C#\nTimeSpan.FromMilliseconds(1299630020).Humanize(3, collectionSeparator: \" - \") =\u003e \"2 weeks - 1 day - 1 hour\"\n````\n\nIt is also possible to use the current culture's collection formatter to combine the time units. To do so, specify `null` as the `collectionSeparator` parameter:\n\n```C#\n// in en-US culture\nTimeSpan.FromMilliseconds(1299630020).Humanize(3, collectionSeparator: null) =\u003e \"2 weeks, 1 day, and 1 hour\"\n\n// in de-DE culture\nTimeSpan.FromMilliseconds(1299630020).Humanize(3, collectionSeparator: null) =\u003e \"2 Wochen, Ein Tag und Eine Stunde\"\n```\n\nIf words are preferred to numbers, a `toWords: true` parameter can be set to convert the numbers in a humanized TimeSpan to words:\n```C#\nTimeSpan.FromMilliseconds(1299630020).Humanize(3, toWords: true) =\u003e \"two weeks, one day, one hour\"\n````\n\n### \u003ca id=\"humanize-collections\"\u003eHumanize Collections\u003c/a\u003e\nYou can call `Humanize` on any `IEnumerable` to get a nicely formatted string representing the objects in the collection. By default `ToString()` will be called on each item to get its representation but a formatting function may be passed to `Humanize` instead. Additionally, a default separator is provided (\"and\" in English), but a different separator may be passed into `Humanize`.\n\nFor instance:\n\n```C#\nclass SomeClass\n{\n    public string SomeString;\n    public int SomeInt;\n    public override string ToString()\n    {\n        return \"Specific String\";\n    }\n}\n\nstring FormatSomeClass(SomeClass sc)\n{\n    return string.Format(\"SomeObject #{0} - {1}\", sc.SomeInt, sc.SomeString);\n}\n\nvar collection = new List\u003cSomeClass\u003e\n{\n    new SomeClass { SomeInt = 1, SomeString = \"One\" },\n    new SomeClass { SomeInt = 2, SomeString = \"Two\" },\n    new SomeClass { SomeInt = 3, SomeString = \"Three\" }\n};\n\ncollection.Humanize()                                    // \"Specific String, Specific String, and Specific String\"\ncollection.Humanize(\"or\")                                // \"Specific String, Specific String, or Specific String\"\ncollection.Humanize(FormatSomeClass)                     // \"SomeObject #1 - One, SomeObject #2 - Two, and SomeObject #3 - Three\"\ncollection.Humanize(sc =\u003e sc.SomeInt.Ordinalize(), \"or\") // \"1st, 2nd, or 3rd\"\n```\n\nItems are trimmed and blank (NullOrWhitespace) items are skipped. This results in clean comma punctuation. (If there is a custom formatter function, this applies only to the formatter's output.)\n\nYou can provide your own collection formatter by implementing `ICollectionFormatter` and registering it with `Configurator.CollectionFormatters`.\n \n### \u003ca id=\"inflector-methods\"\u003eInflector methods\u003c/a\u003e\nThere are also a few inflector methods:\n\n#### \u003ca id=\"pluralize\"\u003ePluralize\u003c/a\u003e\n`Pluralize` pluralizes the provided input while taking irregular and uncountable words into consideration:\n\n```C#\n\"Man\".Pluralize() =\u003e \"Men\"\n\"string\".Pluralize() =\u003e \"strings\"\n```\n\nNormally you would call `Pluralize` on a singular word but if you're unsure about the singularity of the word you can call the method with the optional `inputIsKnownToBeSingular` argument:\n\n```C#\n\"Men\".Pluralize(inputIsKnownToBeSingular: false) =\u003e \"Men\"\n\"Man\".Pluralize(inputIsKnownToBeSingular: false) =\u003e \"Men\"\n\"string\".Pluralize(inputIsKnownToBeSingular: false) =\u003e \"strings\"\n```\n\n\nThe overload of `Pluralize` with `plurality` argument is obsolete and was removed in version 2.0.\n\n#### \u003ca id=\"singularize\"\u003eSingularize\u003c/a\u003e\n`Singularize` singularizes the provided input while taking irregular and uncountable words into consideration:\n\n```C#\n\"Men\".Singularize() =\u003e \"Man\"\n\"strings\".Singularize() =\u003e \"string\"\n```\n\nNormally you would call `Singularize` on a plural word but if you're unsure about the plurality of the word you can call the method with the optional `inputIsKnownToBePlural` argument:\n\n```C#\n\"Men\".Singularize(inputIsKnownToBePlural: false) =\u003e \"Man\"\n\"Man\".Singularize(inputIsKnownToBePlural: false) =\u003e \"Man\"\n\"strings\".Singularize(inputIsKnownToBePlural: false) =\u003e \"string\"\n```\n\n\nThe overload of `Singularize` with `plurality` argument is obsolete and was removed in version 2.0.\n\n## \u003ca id=\"adding-words\"\u003eAdding Words\u003c/a\u003e\nSometimes, you may need to add a rule from the singularization/pluralization vocabulary (the examples below are already in the `DefaultVocabluary` used by `Inflector`):\n\n```C#\n// Adds a word to the vocabulary which cannot easily be pluralized/singularized by RegEx.\n// Will match both \"salesperson\" and \"person\".\nVocabularies.Default.AddIrregular(\"person\", \"people\");\n\n// To only match \"person\" and not \"salesperson\" you would pass false for the 'matchEnding' parameter.\nVocabularies.Default.AddIrregular(\"person\", \"people\", matchEnding: false);\n\n// Adds an uncountable word to the vocabulary.  Will be ignored when plurality is changed:\nVocabularies.Default.AddUncountable(\"fish\");\n\n// Adds a rule to the vocabulary that does not follow trivial rules for pluralization:\nVocabularies.Default.AddPlural(\"bus\", \"buses\");\n\n// Adds a rule to the vocabulary that does not follow trivial rules for singularization\n// (will match both \"vertices\" -\u003e \"vertex\" and \"indices\" -\u003e \"index\"):\nVocabularies.Default.AddSingular(\"(vert|ind)ices$\", \"$1ex\");\n\n```\n\n#### \u003ca id=\"toquantity\"\u003eToQuantity\u003c/a\u003e\nMany times you want to call `Singularize` and `Pluralize` to prefix a word with a number; e.g. \"2 requests\", \"3 men\". `ToQuantity` prefixes the provided word with the number and accordingly pluralizes or singularizes the word:\n\n```C#\n\"case\".ToQuantity(0) =\u003e \"0 cases\"\n\"case\".ToQuantity(1) =\u003e \"1 case\"\n\"case\".ToQuantity(5) =\u003e \"5 cases\"\n\"man\".ToQuantity(0) =\u003e \"0 men\"\n\"man\".ToQuantity(1) =\u003e \"1 man\"\n\"man\".ToQuantity(2) =\u003e \"2 men\"\n```\n\n`ToQuantity` can figure out whether the input word is singular or plural and will singularize or pluralize as necessary:\n\n```C#\n\"men\".ToQuantity(2) =\u003e \"2 men\"\n\"process\".ToQuantity(2) =\u003e \"2 processes\"\n\"process\".ToQuantity(1) =\u003e \"1 process\"\n\"processes\".ToQuantity(2) =\u003e \"2 processes\"\n\"processes\".ToQuantity(1) =\u003e \"1 process\"\n```\n\nYou can also pass a second argument, `ShowQuantityAs`, to `ToQuantity` to specify how you want the provided quantity to be outputted. The default value is `ShowQuantityAs.Numeric` which is what we saw above. The other two values are `ShowQuantityAs.Words` and `ShowQuantityAs.None`.\n\n```C#\n\"case\".ToQuantity(5, ShowQuantityAs.Words) =\u003e \"five cases\"\n\"case\".ToQuantity(5, ShowQuantityAs.None) =\u003e \"cases\"\n```\n\nThere is also an overload that allows you to format the number. You can pass in the format and the culture to be used.\n\n```C#\n\"dollar\".ToQuantity(2, \"C0\", new CultureInfo(\"en-US\")) =\u003e \"$2 dollars\"\n\"dollar\".ToQuantity(2, \"C2\", new CultureInfo(\"en-US\")) =\u003e \"$2.00 dollars\"\n\"cases\".ToQuantity(12000, \"N0\") =\u003e \"12,000 cases\"\n```\n\n#### \u003ca id=\"ordinalize\"\u003eOrdinalize\u003c/a\u003e\n`Ordinalize` turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th:\n\n```C#\n1.Ordinalize() =\u003e \"1st\"\n5.Ordinalize() =\u003e \"5th\"\n```\n\nYou can also call `Ordinalize` on a numeric string and achieve the same result: `\"21\".Ordinalize()` =\u003e `\"21st\"`\n\n`Ordinalize` also supports grammatical gender for both forms.\nYou can pass an argument to `Ordinalize` to specify which gender the number should be outputted in.\nThe possible values are `GrammaticalGender.Masculine`, `GrammaticalGender.Feminine` and `GrammaticalGender.Neuter`:\n\n```C#\n// for Brazilian Portuguese locale\n1.Ordinalize(GrammaticalGender.Masculine) =\u003e \"1º\"\n1.Ordinalize(GrammaticalGender.Feminine) =\u003e \"1ª\"\n1.Ordinalize(GrammaticalGender.Neuter) =\u003e \"1º\"\n\"2\".Ordinalize(GrammaticalGender.Masculine) =\u003e \"2º\"\n\"2\".Ordinalize(GrammaticalGender.Feminine) =\u003e \"2ª\"\n\"2\".Ordinalize(GrammaticalGender.Neuter) =\u003e \"2º\"\n```\n\nObviously this only applies to some cultures. For others passing gender in or not passing at all doesn't make any difference in the result.\n\n#### \u003ca id=\"titleize\"\u003eTitleize\u003c/a\u003e\n`Titleize` converts the input words to Title casing; equivalent to `\"some title\".Humanize(LetterCasing.Title)`\n\n#### \u003ca id=\"pascalize\"\u003ePascalize\u003c/a\u003e\n`Pascalize` converts the input words to UpperCamelCase, also removing underscores and spaces:\n\n```C#\n\"some_title for something\".Pascalize() =\u003e \"SomeTitleForSomething\"\n```\n\n#### \u003ca id=\"camelize\"\u003eCamelize\u003c/a\u003e\n`Camelize` behaves identically to `Pascalize`, except that the first character is lower case:\n\n```C#\n\"some_title for something\".Camelize() =\u003e \"someTitleForSomething\"\n```\n\n#### \u003ca id=\"underscore\"\u003eUnderscore\u003c/a\u003e\n`Underscore` separates the input words with underscore:\n\n```C#\n\"SomeTitle\".Underscore() =\u003e \"some_title\"\n```\n\n#### \u003ca id=\"dasherize--hyphenate\"\u003eDasherize \u0026 Hyphenate\u003c/a\u003e\n`Dasherize` and `Hyphenate` replace underscores with dashes in the string:\n\n```C#\n\"some_title\".Dasherize() =\u003e \"some-title\"\n\"some_title\".Hyphenate() =\u003e \"some-title\"\n```\n\n#### \u003ca id=\"kebaberize\"\u003eKebaberize\u003c/a\u003e\n`Kebaberize` separates the input words with hyphens and all words are converted to lowercase \n\n```C#\n\"SomeText\".Kebaberize() =\u003e \"some-text\"\n```\n\n### \u003ca id=\"fluent-date\"\u003eFluent Date\u003c/a\u003e\nHumanizer provides a fluent API to deal with `DateTime` and `TimeSpan` as follows:\n\n`TimeSpan` methods:\n\n```C#\n2.Milliseconds() =\u003e TimeSpan.FromMilliseconds(2)\n2.Seconds() =\u003e TimeSpan.FromSeconds(2)\n2.Minutes() =\u003e TimeSpan.FromMinutes(2)\n2.Hours() =\u003e TimeSpan.FromHours(2)\n2.Days() =\u003e TimeSpan.FromDays(2)\n2.Weeks() =\u003e TimeSpan.FromDays(14)\n```\n\n\u003csmall\u003eThere are no fluent APIs for month or year as a month could have between 28 to 31 days and a year could be 365 or 366 days.\u003c/small\u003e\n\nYou could use these methods to, for example, replace\n\n```C#\nDateTime.Now.AddDays(2).AddHours(3).AddMinutes(-5)\n```\n\nwith\n\n```C#\nDateTime.Now + 2.Days() + 3.Hours() - 5.Minutes()\n```\n\nThere are also three categories of fluent methods to deal with `DateTime`:\n\n```C#\nIn.TheYear(2010) // Returns the first of January of 2010\nIn.January // Returns 1st of January of the current year\nIn.FebruaryOf(2009) // Returns 1st of February of 2009\n\nIn.One.Second //  DateTime.UtcNow.AddSeconds(1);\nIn.Two.SecondsFrom(DateTime dateTime)\nIn.Three.Minutes // With corresponding From method\nIn.Three.Hours // With corresponding From method\nIn.Three.Days // With corresponding From method\nIn.Three.Weeks // With corresponding From method\nIn.Three.Months // With corresponding From method\nIn.Three.Years // With corresponding From method\n\nOn.January.The4th // Returns 4th of January of the current year\nOn.February.The(12) // Returns 12th of Feb of the current year\n```\n\nand some extension methods:\n\n```C#\nvar someDateTime = new DateTime(2011, 2, 10, 5, 25, 45, 125);\n\n// Returns new DateTime(2008, 2, 10, 5, 25, 45, 125) changing the year to 2008\nsomeDateTime.In(2008)\n\n// Returns new DateTime(2011, 2, 10, 2, 25, 45, 125) changing the hour to 2:25:45.125\nsomeDateTime.At(2)\n\n// Returns new DateTime(2011, 2, 10, 2, 20, 15, 125) changing the time to 2:20:15.125\nsomeDateTime.At(2, 20, 15)\n\n// Returns new DateTime(2011, 2, 10, 12, 0, 0) changing the time to 12:00:00.000\nsomeDateTime.AtNoon()\n\n// Returns new DateTime(2011, 2, 10, 0, 0, 0) changing the time to 00:00:00.000\nsomeDateTime.AtMidnight()\n```\n\nObviously you could chain the methods too; e.g. `On.November.The13th.In(2010).AtNoon + 5.Minutes()`\n\n### \u003ca id=\"number-to-numbers\"\u003eNumber to numbers\u003c/a\u003e\nHumanizer provides a fluent API that produces (usually big) numbers in a clearer fashion:\n\n```C#\n1.25.Billions() =\u003e 1250000000\n3.Hundreds().Thousands() =\u003e 300000\n```\n\n### \u003ca id=\"number-towords\"\u003eNumber to words\u003c/a\u003e\nHumanizer can change numbers to words using the `ToWords` extension:\n\n```C#\n1.ToWords() =\u003e \"one\"\n10.ToWords() =\u003e \"ten\"\n11.ToWords() =\u003e \"eleven\"\n122.ToWords() =\u003e \"one hundred and twenty-two\"\n3501.ToWords() =\u003e \"three thousand five hundred and one\"\n```\n\nYou can also pass a second argument, `GrammaticalGender`, to `ToWords` to specify which gender the number should be outputted in.\nThe possible values are `GrammaticalGender.Masculine`, `GrammaticalGender.Feminine` and `GrammaticalGender.Neuter`:\n\n```C#\n// for Russian locale\n1.ToWords(GrammaticalGender.Masculine) =\u003e \"один\"\n1.ToWords(GrammaticalGender.Feminine) =\u003e \"одна\"\n1.ToWords(GrammaticalGender.Neuter) =\u003e \"одно\"\n```\n\n```C#\n// for Arabic locale\n1.ToWords(GrammaticalGender.Masculine) =\u003e \"واحد\"\n1.ToWords(GrammaticalGender.Feminine) =\u003e \"واحدة\"\n1.ToWords(GrammaticalGender.Neuter) =\u003e \"واحد\"\n(-1).ToWords() =\u003e \"ناقص واحد\"\n```\n\nObviously this only applies to some cultures. For others passing gender in doesn't make any difference in the result.\n\nAlso, culture to use can be specified explicitly. If it is not, current thread's current UI culture is used. Here's an example:\n\n```C#\n11.ToWords(new CultureInfo(\"en\")) =\u003e \"eleven\"\n1.ToWords(GrammaticalGender.Masculine, new CultureInfo(\"ru\")) =\u003e \"один\"\n```\n\n### \u003ca id=\"number-toordinalwords\"\u003eNumber to ordinal words\u003c/a\u003e\nThis is kind of mixing `ToWords` with `Ordinalize`. You can call `ToOrdinalWords` on a number to get an ordinal representation of the number in words! For example:\n\n```C#\n0.ToOrdinalWords() =\u003e \"zeroth\"\n1.ToOrdinalWords() =\u003e \"first\"\n2.ToOrdinalWords() =\u003e \"second\"\n8.ToOrdinalWords() =\u003e \"eighth\"\n10.ToOrdinalWords() =\u003e \"tenth\"\n11.ToOrdinalWords() =\u003e \"eleventh\"\n12.ToOrdinalWords() =\u003e \"twelfth\"\n20.ToOrdinalWords() =\u003e \"twentieth\"\n21.ToOrdinalWords() =\u003e \"twenty first\"\n121.ToOrdinalWords() =\u003e \"hundred and twenty first\"\n```\n\n`ToOrdinalWords` also supports grammatical gender.\nYou can pass a second argument to `ToOrdinalWords` to specify the gender of the output.\nThe possible values are `GrammaticalGender.Masculine`, `GrammaticalGender.Feminine` and `GrammaticalGender.Neuter`:\n\n```C#\n// for Brazilian Portuguese locale\n1.ToOrdinalWords(GrammaticalGender.Masculine) =\u003e \"primeiro\"\n1.ToOrdinalWords(GrammaticalGender.Feminine) =\u003e \"primeira\"\n1.ToOrdinalWords(GrammaticalGender.Neuter) =\u003e \"primeiro\"\n2.ToOrdinalWords(GrammaticalGender.Masculine) =\u003e \"segundo\"\n2.ToOrdinalWords(GrammaticalGender.Feminine) =\u003e \"segunda\"\n2.ToOrdinalWords(GrammaticalGender.Neuter) =\u003e \"segundo\"\n```\n\n```C#\n// for Arabic locale\n1.ToOrdinalWords(GrammaticalGender.Masculine) =\u003e \"الأول\"\n1.ToOrdinalWords(GrammaticalGender.Feminine) =\u003e \"الأولى\"\n1.ToOrdinalWords(GrammaticalGender.Neuter) =\u003e \"الأول\"\n2.ToOrdinalWords(GrammaticalGender.Masculine) =\u003e \"الثاني\"\n2.ToOrdinalWords(GrammaticalGender.Feminine) =\u003e \"الثانية\"\n2.ToOrdinalWords(GrammaticalGender.Neuter) =\u003e \"الثاني\"\n```\n\nObviously this only applies to some cultures. For others passing gender in doesn't make any difference in the result.\n\nAlso, culture to use can be specified explicitly. If it is not, current thread's current UI culture is used. Here's an example:\n\n```C#\n10.ToOrdinalWords(new CultureInfo(\"en-US\")) =\u003e \"tenth\"\n1.ToOrdinalWords(GrammaticalGender.Masculine, new CulureInfo(\"pt-BR\")) =\u003e \"primeiro\"\n```\n\n\n### \u003ca id=\"date-time-to-ordinal-words\"\u003eDateTime to ordinal words\u003c/a\u003e\nThis is kind of an extension of Ordinalize\n```C#\n// for English UK locale\nnew DateTime(2015, 1, 1).ToOrdinalWords() =\u003e \"1st January 2015\"\nnew DateTime(2015, 2, 12).ToOrdinalWords() =\u003e \"12th February 2015\"\nnew DateTime(2015, 3, 22).ToOrdinalWords() =\u003e \"22nd March 2015\"\n// for English US locale\nnew DateTime(2015, 1, 1).ToOrdinalWords() =\u003e \"January 1st, 2015\"\nnew DateTime(2015, 2, 12).ToOrdinalWords() =\u003e \"February 12th, 2015\"\nnew DateTime(2015, 3, 22).ToOrdinalWords() =\u003e \"March 22nd, 2015\"\n```\n\n`ToOrdinalWords` also supports grammatical case.\nYou can pass a second argument to `ToOrdinalWords` to specify the case of the output.\nThe possible values are `GrammaticalCase.Nominative`, `GrammaticalCase.Genitive`, `GrammaticalCase.Dative`, `GrammaticalCase.Accusative`, `GrammaticalCase.Instrumental` and `GrammaticalGender.Prepositional`:\n\n```C#\n```\n\nObviously this only applies to some cultures. For others passing case in doesn't make any difference in the result.\n\n### \u003ca id=\"roman-numerals\"\u003eRoman numerals\u003c/a\u003e\nHumanizer can change numbers to Roman numerals using the `ToRoman` extension. The numbers 1 to 10 can be expressed in Roman numerals as follows:\n\n```C#\n1.ToRoman() =\u003e \"I\"\n2.ToRoman() =\u003e \"II\"\n3.ToRoman() =\u003e \"III\"\n4.ToRoman() =\u003e \"IV\"\n5.ToRoman() =\u003e \"V\"\n6.ToRoman() =\u003e \"VI\"\n7.ToRoman() =\u003e \"VII\"\n8.ToRoman() =\u003e \"VIII\"\n9.ToRoman() =\u003e \"IX\"\n10.ToRoman() =\u003e \"X\"\n```\n\nAlso the reverse operation using the `FromRoman` extension.\n\n```C#\n\"I\".FromRoman() =\u003e 1\n\"II\".FromRoman() =\u003e 2\n\"III\".FromRoman() =\u003e 3\n\"IV\".FromRoman() =\u003e 4\n\"V\".FromRoman() =\u003e 5\n```\nNote that only integers smaller than 4000 can be converted to Roman numerals. \n\n### \u003ca id=\"metric-numerals\"\u003eMetric numerals\u003c/a\u003e\nHumanizer can change numbers to Metric numerals using the `ToMetric` extension. The numbers 1, 1230 and 0.1 can be expressed in Metric numerals as follows:\n\n```C#\n1d.ToMetric() =\u003e \"1\"\n1230d.ToMetric() =\u003e \"1.23k\"\n0.1d.ToMetric() =\u003e \"100m\"\n```\n\nAlso the reverse operation using the `FromMetric` extension.\n\n```C#\n1d.ToMetric() =\u003e \"1\"\n1230d.ToMetric() =\u003e \"1.23k\"\n0.1d.ToMetric() =\u003e \"100m\"\n\n\"1\".FromMetric() =\u003e 1\n\"1.23k\".FromMetric() =\u003e 1230\n\"100m\".FromMetric() =\u003e 0.1\n```\n\n### \u003ca id=\"bytesize\"\u003eByteSize\u003c/a\u003e\nHumanizer includes a port of the brilliant [ByteSize](https://github.com/omar/ByteSize) library.\nQuite a few changes and additions are made on `ByteSize` to make the interaction with `ByteSize` easier and more consistent with the Humanizer API.\nHere is a few examples of how you can convert from numbers to byte sizes and between size magnitudes:\n\n```c#\nvar fileSize = (10).Kilobytes();\n\nfileSize.Bits      =\u003e 81920\nfileSize.Bytes     =\u003e 10240\nfileSize.Kilobytes =\u003e 10\nfileSize.Megabytes =\u003e 0.009765625\nfileSize.Gigabytes =\u003e 9.53674316e-6\nfileSize.Terabytes =\u003e 9.31322575e-9\n```\n\nThere are a few extension methods that allow you to turn a number into a ByteSize instance:\n\n```C#\n3.Bits();\n5.Bytes();\n(10.5).Kilobytes();\n(2.5).Megabytes();\n(10.2).Gigabytes();\n(4.7).Terabytes();\n```\n\nYou can also add/subtract the values using +/- operators and Add/Subtract methods:\n\n```C#\nvar total = (10).Gigabytes() + (512).Megabytes() - (2.5).Gigabytes();\ntotal.Subtract((2500).Kilobytes()).Add((25).Megabytes());\n```\n\nA `ByteSize` object contains two properties that represent the largest metric prefix symbol and value:\n\n```C#\nvar maxFileSize = (10).Kilobytes();\n\nmaxFileSize.LargestWholeNumberSymbol;  // \"KB\"\nmaxFileSize.LargestWholeNumberValue;   // 10\n```\n\nIf you want a string representation you can call `ToString` or `Humanize` interchangeably on the `ByteSize` instance:\n\n```C#\n7.Bits().ToString();           // 7 b\n8.Bits().ToString();           // 1 B\n(.5).Kilobytes().Humanize();   // 512 B\n(1000).Kilobytes().ToString(); // 1000 KB\n(1024).Kilobytes().Humanize(); // 1 MB\n(.5).Gigabytes().Humanize();   // 512 MB\n(1024).Gigabytes().ToString(); // 1 TB\n```\n\nYou can also optionally provide a format for the expected string representation.\nThe formatter can contain the symbol of the value to display: `b`, `B`, `KB`, `MB`, `GB`, `TB`.\nThe formatter uses the built in [`double.ToString` method](https://docs.microsoft.com/dotnet/api/system.double.tostring) with `#.##` as the default format which rounds the number to two decimal places:\n\n```C#\nvar b = (10.505).Kilobytes();\n\n// Default number format is #.##\nb.ToString(\"KB\");         // 10.52 KB\nb.Humanize(\"MB\");         // .01 MB\nb.Humanize(\"b\");          // 86057 b\n\n// Default symbol is the largest metric prefix value \u003e= 1\nb.ToString(\"#.#\");        // 10.5 KB\n\n// All valid values of double.ToString(string format) are acceptable\nb.ToString(\"0.0000\");     // 10.5050 KB\nb.Humanize(\"000.00\");     // 010.51 KB\n\n// You can include number format and symbols\nb.ToString(\"#.#### MB\");  // .0103 MB\nb.Humanize(\"0.00 GB\");    // 0 GB\nb.Humanize(\"#.## B\");     // 10757.12 B\n```\n\nIf you want a string representation with full words you can call `ToFullWords` on the `ByteSize` instance:\n\n```C#\n7.Bits().ToFullWords();           // 7 bits\n8.Bits().ToFullWords();           // 1 byte\n(.5).Kilobytes().ToFullWords();   // 512 bytes\n(1000).Kilobytes().ToFullWords(); // 1000 kilobytes\n(1024).Kilobytes().ToFullWords(); // 1 megabyte\n(.5).Gigabytes().ToFullWords();   // 512 megabytes\n(1024).Gigabytes().ToFullWords(); // 1 terabyte\n```\n\nThere isn't a `Dehumanize` method to turn a string representation back into a `ByteSize` instance; but you can use `Parse` and `TryParse` on `ByteSize` to do that.\nLike other `TryParse` methods, `ByteSize.TryParse` returns `boolean` value indicating whether or not the parsing was successful.\nIf the value is parsed it is output to the `out` parameter supplied:\n\n```C#\nByteSize output;\nByteSize.TryParse(\"1.5mb\", out output);\n\n// Invalid\nByteSize.Parse(\"1.5 b\");   // Can't have partial bits\n\n// Valid\nByteSize.Parse(\"5b\");\nByteSize.Parse(\"1.55B\");\nByteSize.Parse(\"1.55KB\");\nByteSize.Parse(\"1.55 kB \"); // Spaces are trimmed\nByteSize.Parse(\"1.55 kb\");\nByteSize.Parse(\"1.55 MB\");\nByteSize.Parse(\"1.55 mB\");\nByteSize.Parse(\"1.55 mb\");\nByteSize.Parse(\"1.55 GB\");\nByteSize.Parse(\"1.55 gB\");\nByteSize.Parse(\"1.55 gb\");\nByteSize.Parse(\"1.55 TB\");\nByteSize.Parse(\"1.55 tB\");\nByteSize.Parse(\"1.55 tb\");\n```\n\nFinally, if you need to calculate the rate at which a quantity of bytes has been transferred, you can use the `Per` method of `ByteSize`. The `Per` method accepts one argument - the measurement interval for the bytes; this is the amount of time it took to transfer the bytes.\n\nThe `Per` method returns a `ByteRate` class which has a `Humanize` method. By default, rates are given in seconds (eg, MB/s). However, if desired, a TimeUnit may be passed to `Humanize` for an alternate interval. Valid intervals are `TimeUnit.Second`, `TimeUnit.Minute`, and `TimeUnit.Hour`. Examples of each interval and example byte rate usage is below.\n\n```C#\nvar size = ByteSize.FromMegabytes(10);\nvar measurementInterval = TimeSpan.FromSeconds(1);\n\nvar text = size.Per(measurementInterval).Humanize();\n// 10 MB/s\n\ntext = size.Per(measurementInterval).Humanize(TimeUnit.Minute);\n// 600 MB/min\n\ntext = size.Per(measurementInterval).Humanize(TimeUnit.Hour);\n// 35.15625 GB/hour\n```\n\nYou can specify a format for the bytes part of the humanized output:\n\n```C#\n19854651984.Bytes().Per(1.Seconds()).Humanize(\"#.##\");\n// 18.49 GB/s\n```\n\n### \u003ca id=\"heading-to-words\"\u003eHeading to words\u003c/a\u003e\nHumanizer includes methods to change a numeric heading to words. The heading can be a `double` whereas the result will be a string. You can choose whether to return a full representation of the heading (e.g. north, east, south or west), a short representation (e.g. N, E, S, W) or a unicode arrow character (e.g. ↑, →, ↓, ←).\n\n```C#\n360.ToHeading();\n// north\n720.ToHeading();\n// north\n```\n\nIn order to retrieve a short version of the heading you can use the following call:\n\n```C#\n180.ToHeading(true);\n// S\n360.ToHeading(true);\n// N\n```\n\nPlease note that a textual representation has a maximum deviation of 11.25°.\n\nThe methods above all have an overload with which you can provide a `CultureInfo` object in order to determine the localized result to return.\n\nTo retrieve an arrow representing the heading use the following method:\n\n```C#\n90.ToHeadingArrow();\n// →\n225.ToHeadingArrow();\n// ↙\n```\n\nThe arrow representation of the heading has a maximum deviation of 22.5°.\n\nIn order to retrieve a heading based on the short text representation (e.g. N, E, S, W), the following method can be used:\n\n```C#\n\"S\".FromShortHeading();\n// 180\n\"SW\".FromShortHeading();\n// 225\n```\n\n### \u003ca id=\"tupleize\"\u003eTupleize\u003c/a\u003e\nHumanizer can change whole numbers into their 'tuple'  using `Tupleize`. For example:\n\n```C#\n1.Tupleize();\n// single\n3.Tupleize();\n// triple\n100.Tupleize();\n// centuple\n```\n\nThe numbers 1-10, 100 and 1000 will be converted into a 'named' tuple (i.e. \"single\", \"double\" etc.). Any other number \"n\" will be converted to \"n-tuple\".\n\n## \u003ca id=\"how-to-contribute\"\u003eHow to contribute?\u003c/a\u003e\n\nPlease see \u003ca href=\"https://github.com/Humanizr/Humanizer/blob/master/CONTRIBUTING.md\"\u003eCONTRIBUTING.md\u003c/a\u003e.\n\n## \u003ca id=\"main-contributors\"\u003eMain contributors\u003c/a\u003e\n - Mehdi Khalili ([@MehdiKhalili](https://twitter.com/MehdiKhalili))\n - Claire Novotny ([@clairernovotny](https://twitter.com/clairernovotny))\n - Alexander I. Zaytsev ([@hazzik](https://github.com/hazzik))\n - Max Malook ([@mexx](https://github.com/mexx))\n\n## \u003ca id=\"license\"\u003eLicense\u003c/a\u003e\nHumanizer is released under the MIT License. See the [bundled LICENSE](https://github.com/Humanizr/Humanizer/blob/master/LICENSE) file for details.\n\n## \u003ca id=\"icon\"\u003eIcon\u003c/a\u003e\nIcon created by [Tyrone Rieschiek](https://twitter.com/Inkventive)\n\n## \u003ca id=\"support\"\u003eSupport\u003c/a\u003e\nUnfortunately I have not seen any source to support the Humanizr team by means of donating. Please spread your love at the original repository located here: [Humanizr/Humanizer](https://github.com/Humanizr/Humanizer)\n\nIf you want to support my work you are in no way obliged to, but it is very much appreciated. You can support me by donating through the button below.\n\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/J3J11GEYY)\n","funding_links":["https://ko-fi.com/J3J11GEYY"],"categories":["Open Source Repositories","C\\#","C#"],"sub_categories":["Utilities"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThundernerd%2FUnity3D-Humanizr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FThundernerd%2FUnity3D-Humanizr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThundernerd%2FUnity3D-Humanizr/lists"}