Skip to content

Commit

Permalink
Add example for TimeUnitToSymbolExtensions.ToSymbol
Browse files Browse the repository at this point in the history
  • Loading branch information
hangy committed Jul 3, 2021
1 parent f73a2a0 commit 2e3c668
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Humanizer meets all your .NET needs for manipulating and displaying strings, enu
- [ByteSize](#bytesize)
- [Heading to words](#heading-to-words)
- [Tupleize](#tupleize)
- [Time unit to symbol](#timeunit-to-symbol)
- [Mix this into your framework to simplify your life](#mix-this-into-your-framework-to-simplify-your-life) -
- [How to contribute?](#how-to-contribute)
- [Continuous Integration from AppVeyor](#continuous-integration)
Expand Down Expand Up @@ -1109,6 +1110,18 @@ Humanizer can change whole numbers into their 'tuple' using `Tupleize`. For exa

The 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".

### <a id="timeunit-to-symbol">Time unit to symbol</a>
Humanizer can translate time units to their symbols:

```C#
TimeUnit.Day.ToSymbol();
// d
TimeUnit.Week.ToSymbol();
// week
TimeUnit.Year.ToSymbol();
// a
```

## <a id="mix-this-into-your-framework-to-simplify-your-life">Mix this into your framework to simplify your life</a>
This is just a baseline and you can use this to simplify your day to day job. For example, in Asp.Net MVC we keep chucking `Display` attribute on ViewModel properties so `HtmlHelper` can generate correct labels for us; but, just like enums, in vast majority of cases we just need a space between the words in property name - so why not use `"string".Humanize` for that?!

Expand Down

0 comments on commit 2e3c668

Please sign in to comment.